// Practice17.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <iostream>
using namespace std;
class base{
private:
int i;
public:
base(int a)
{
i = a;
}
void show()
{
cout << i << endl;
}
};
class derived :public base{
private:
base d;
public:
derived(int i) :base(i)
{
d(i);
}
void show(){
base::show();
}
};
int _tmain(int argc, _TCHAR* argv[])
{
derived obj(100);
obj.show();
system("pause");
return 0;
}
相关分类