#include<iostream.h>
class A	
{
public:	
  seta(int x=0);
  int geta(void);
private:
  int a;
};
A::seta(int x)
{
  a=x;
}
int A::geta(void)
{
  return(a);
}
class B:public A //公有继承	
{
public:	
  setb(int x=0);
  int getb(void);
private:
  int b;
};
B::setb(int x)
{
  b=x;
}
int B::getb(void)
{
  return(b);
}
int main()
{
 B obj;
 obj.seta(1);
 obj.setb(2);
 cout<<"类B的长度是 "<<sizeof(obj)<<endl;
 cout<<"a="<<obj.geta()<<" b="<<obj.getb()<<endl;  
 return(0);
}
