64,682
社区成员
发帖
与我相关
我的任务
分享
class CA {
public:
CA() { cout << "using ca's constractor\n"; }
CA(int k) {cout << "using ca's 2nd constractor, k is " << k << endl; m = k;};
virtual ~CA() { cout << "using ca's disconstractor\n"; }
void output() { cout << "the m is " << m << endl; }
private:
int m;
};
class CB : public CA {
public:
CB(int k) { m = k; }
};
class CB : public CA {
public:
CB(int k) : CA(k) {}
#include <iostream>
using namespace std;
class Base
{
public:
Base()
{
cout << "Do some spatial operation!" << endl;
}
};
class Derived : public Base
{
public:
Derived() : Base()
{
cout << "Derived Constructor!" << endl;
}
};
int main()
{
Derived dr;
return 0;
}