第三课的课后练习

6 篇文章 0 订阅
#pragma once
#include<iostream>
using namespace std;

class A
{
private:
	int n;

public:
	A(void);
	~A(void);

	void f();
	virtual void g(void);
};
#include "stdafx.h"
#include "A.h"


A::A(void)
{
}


A::~A(void)
{
}

void A::f()
{
}

void A::g(void)
{
	cout<<"A::g()"<<endl;
}
#pragma once
#include "a.h"
class AA :
	public A
{
public:
	AA(void);
	~AA(void);
	int k;
	virtual void g(void);
};

#include "stdafx.h"
#include "AA.h"


AA::AA(void)
{
}


AA::~AA(void)
{
}


void AA::g(void)
{
	cout<<"AA::g()"<<endl;
}
#pragma once
#include "a.h"
#include"b.h"
class AB :
	public A,public B
{
public:
	AB(void);
	~AB(void);
};

#include "stdafx.h"
#include "AB.h"


AB::AB(void)
{
}


AB::~AB(void)
{
}
#pragma once
class B
{
public:
	B(void);
	~B(void);
	int l;

	void h(void);
};

#include "stdafx.h"
#include "B.h"


B::B(void)
{
}


B::~B(void)
{
}

void B::h(void)
{
}
// Ex3_2.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include"aa.h"
#include"ab.h"

int _tmain(int argc, _TCHAR* argv[])
{
	A a,*pa;
	AA aa,*paa;
//	pa=&a;
//	paa=&aa;
//	pa->g();
//	paa->g();      

	pa=&aa;

	pa->g();

	AB ab;

	system("PAUSE");
	return 0;
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值