class A
{
public:
int a;
A()
{
}
void print()
{
cout<<a;
}
};
class B:public A
{
public:
int a;
B()
{
a = 2;
}
};
int main()
{
B b;
b.print();
return 0;
}
输出随机值
class A
{
public:
int a;
A()
{
}
void print()
{
cout<<a;
}
};
class B:public A
{
public:
int a;
B()
{
a = 2;
}
};
int main()
{
B b;
b.print();
return 0;
}
输出随机值