enum CPU_rank{p1=1,p2,p3,p4,p5,p6,p7};
class CPU
{
private:
CPU_rank rank;
int frequency;
float voltage;
public:
CPU (CPU_rank r,int f,float v)
{
rank=r;
frequency=f;
voltage=v;
cout<<"构造了一个cpu!"<
~CPU()
{ cout<<"其构了一个cpu!"<
{ return rank;}
void setrank(CPU_rank r)
{ rank=r;}
void run()
{cout<<"cpu开始运行!"<
void stop()
{cout<<"cpu停止运行!"<
class RAM
{
private:
int ram;
public:
RAM(int r)
{ cout<<"构造了一个ram!"<
{cout<<"ram开始运行!"<
{cout<<"ram停止运行!"<
class CDRAM
{
private:
int cdram;
public:
CDRAM(int c)
{ cdram=c;
cout<<"构造了一个cdram!"<
{cout<<"cdram开始运行"<
{cout<<"cdram停止运行"<
class computer
{private:
CPU cpu;RAM ram;CDRAM cdram;
public:
computer(CPU c,RAM r,CDRAM cd);
computer();
~computer(){cout<<"析构了一个computer"<
void run()
{cout<<"computer开始运行"<
{cout<<"computer停止运行"<
computer::computer():cpu(p6,100,float(1.3)),ram(20),cdram(30)
{cout<<"构造了一个 cpu00"<
{cout<<"构造了一个computer"<
{ cout<<"调用了复制构造函数"<
{
CPU m(p6,300,float(2.8));
RAM n(1);
CDRAM q(2);
computer com1;
computer com2(m,n,q);
}