关于c++中类的继承与派生
c++class
[cpp]
#include<iostream>
using namespace std;
class A{
public:
int x;
A(int a,int b){
a=x;
b=u;}
void prt(){
cout<<cout<<x<<endl;}
private:
int u;
};
class B:public A{
public:
B(int a,int b,int c):
A(a,b){
y=c;}
int y;
void prt(){
cout<<"A::x=:"<<A::x<<endl;
A::prt();
cout<<" B::y=:"<<B::y<<endl;
}
};
int main(){
B b(1,2,3);
b.prt();
cout<<b.x<<endl;
}
为什么x的值不是1呢
补充:软件开发 , C++ ,