摘要: /*虚继承*/#include"stdafx.h"#include <iostream.h>class furniture{public: furniture( int nWeight ) { m_nWeight = nWeight; cout << "家具的构造" << endl; } int m_nWeight;};//虚继承//使派生类对象只有一份基类(f... 阅读全文
posted @ 2010-01-30 19:06 o无尘o 阅读(212) 评论(0) 推荐(0) 编辑
摘要: /*纯虚函数*/#include"stdafx.h"#include <iostream.h>class IShape{public: //表示这个虚函数是纯虚函数 //如果一个类中只要有一个纯虚函数,那么这个类就是抽象类 //抽象类不能创建实例 virtualdouble Area() = 0; //派生类中一定要把抽象基类中纯虚函数覆盖 //=0 仅仅表示是纯虚函数,};//=0... 阅读全文
posted @ 2010-01-30 19:02 o无尘o 阅读(238) 评论(0) 推荐(0) 编辑