#include
using namespace std;
class A {
public:
int a, b, q, r;
A(int a, int b);
void getS();
void getX();
private:
int x, y;
};
void A::getX()
{
cout << "访问基类getX():" << q << "," << r << endl;
}
void A::getS()
{
q = x;
r = y;
}
A::A(int a, int b)
{
x = a;
y = b;
}
//..............................................................
class B :public A {
public:
B(int q, int r);
void getW();
void getX();
void getS();
private:
int w, s;
};
void B::getX()
{
cout << "派生类getXXX()" << "w" << w << endl;
A::getX();
}
void B::getS()
{
cout << "派生类getS()" << "s" << s << endl;
}
B::B(int q, int r):A(a,b)
{
w = q;
s = r;
}
void B::getW()
{
cout << "派生类getW()" << endl;
}
int main()
{
A a(3, 2);
cout << a.a;
system("pause");
return 0;
}