#include <iostream>
using namespace std;
// class Base{
// public:
// Base(){cout<<"BB"<<endl;f();}
// void f(){cout<<"Bf"<<endl;}
// };
// class Derived:public Base{
// public:
// Derived(){
// cout<<"DD"<<endl;
// }
// void f(){
// cout<<"DF"<<endl;
// }
// };
// int main() {
// Derived d;
// }
/*
class HowMany{
static int object_count;
public:
HowMany(){cout<<"constructor"<<endl;object_count++;}
HowMany(HowMany &H);
static void print(const char *msg=0){
if(msg)
cout<<msg<<".";
cout<<"object_count="<<object_count<<endl;
}
~HowMany(){object_count--;cout<<"~HowMany()\n";}
};
int HowMany::object_count=0;
HowMany f(HowMany x){
x.print("x argument inside f()");
return x;
}
HowMany::HowMany(HowMany &H){
cout<<"拷贝构造函数"<<endl;
}
int main() {
HowMany h;
// HowMany::print("After constructor of h");
// HowMany h2 = f(h);
HowMany h3 = h;
// HowMany::print("After call to f()");
}
*/
// #include <iostream>
// using namespace std;
// int main() {
// char a ='a';
// cout<<++a<<endl;
// cout<<a+1<<endl;
// int b = 3.14;
// b=b/3;
// cout<<b/3<<endl;
// cout<<"==============="<<endl;
// bool c = a&&b;
// cout<<"a="<<a<<" b="<<b<<endl;
// cout<<(c||a?b*3:a%5)<<endl;
// return 0;
// }
// #include <iostream>
// using namespace std;
// class A {
// public:
// A(){cout<<"A's default constructor called.\n";}
// A(int i){a=i;cout<<"A's constructor called.\n";}
// ~A(){cout<<"A's default destructor called.\n";}
// void Print()const {cout<<a<<",";}
// int Geta(){return a;}
// private:
// int a;
// };
// class B:public A{
// public:
// B(){b=0;cout<<"B's default constructor called.\n";}
// B(int i, int j,int K);
// ~B(){cout<<"B's default destructor called.\n";}
// void Print();
// private:
// int b;
// A aa;
// };
// B::B(int i,int j,int k):A(i),aa(j){
// b=k;
// cout<<"B's constructor called.\n";
// }
// void B::Print(){
// A::Print();
// cout<<b<<","<<aa.Geta()<<endl;
// }
// int main(){
// B bb;
// bb = B(1,2,5);
// bb.Print();
// return 0;
// }
#include <iostream>
using namespace std;
class A {
public:
A(){cout<<"A's default constructor called.\n";}
A(int i){a=i;cout<<"A's constructor called.\n";}
~A(){cout<<"A's default destructor called.\n";}
void Print()const {cout<<a<<",";}
int Geta(){return a;}
private:
int a;
};
class B:public A{
public:
B(){b=0;cout<<"B's default constructor called.\n";}
B(int i, int j,int K);
~B(){cout<<"B's default destructor called.\n";}
void Print();
private:
int b;
A aa;
};
B::B(int i,int j,int k):A(i),aa(j){
b=k;
cout<<"B's constructor called.\n";
}
void B::Print(){
A::Print();
cout<<b<<","<<aa.Geta()<<endl;
}
int main(){
B bb;
B cc;
// bb = B(1,2,5);
return 0;
}