文件名称:CPPexam7zip
- 所属分类:
- 其他小程序
- 资源属性:
- [Windows] [Visual C] [源码]
- 上传时间:
- 2013-11-22
- 文件大小:
- 819kb
- 下载次数:
- 0次
- 提 供 者:
- w***
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
1. 声明一个基类 Animal,有私有整型成员变量 age,构造其派生类 dog,在其成员函
数 SetAge(int n)中直接给 age 赋值,看看会有什么问题,把 age 改为公有成员变量,还会有问题吗?编程试试看。
2. 声明一个基类 BaseClass,有整型成员变量 Number,构造其派生类 DerivedClass,
观察构造函数和析构函数的执行情况。
3. 声明一个车(vehicle)基类,具有 MaxSpeed、Weight 等成员变量,Run、Stop 等成员函数,由此派生出自行车(bicycle)类、汽车(motorcar)类。自行车(bicycle)类有高度(Height)等属性,汽车(motorcar)类有座位数(SeatNum)等属性。从 bicycle和 motorcar 派生出摩托车(motorcycle)类,在继承过程中,注意把 vehicle 设置为虚基类。如果不把 vehicle 设置为虚基类,会有什么问题?编程试试看。
-1. Declare a base class Animal, there are private integer member variable age, constructs its derived classes dog, in its member functions SetAge (int n) directly to the age assignment, to see what the problem is, the age to public member variables, there will be questions? Programming try. (2) declare a base class BaseClass, there is an integer member variable Number, construct its derived classes DerivedClass, observe the constructor and destructor implementation. 3 Declare a car (vehicle) base class, with MaxSpeed, Weight and other member variables, Run, Stop and other member functions, and derives a bike (bicycle), automobiles (motorcar) classes. Bike (bicycle) class has height (Height) and other attributes, automotive (motorcar) class has seats (SeatNum) and other attributes. Derived from the bicycle and motorcar motorcycle (motorcycle) class in the inheritance process, pay attention to the vehicle is set to the virtual base class. If you do not set the vehicle to the virtual base
数 SetAge(int n)中直接给 age 赋值,看看会有什么问题,把 age 改为公有成员变量,还会有问题吗?编程试试看。
2. 声明一个基类 BaseClass,有整型成员变量 Number,构造其派生类 DerivedClass,
观察构造函数和析构函数的执行情况。
3. 声明一个车(vehicle)基类,具有 MaxSpeed、Weight 等成员变量,Run、Stop 等成员函数,由此派生出自行车(bicycle)类、汽车(motorcar)类。自行车(bicycle)类有高度(Height)等属性,汽车(motorcar)类有座位数(SeatNum)等属性。从 bicycle和 motorcar 派生出摩托车(motorcycle)类,在继承过程中,注意把 vehicle 设置为虚基类。如果不把 vehicle 设置为虚基类,会有什么问题?编程试试看。
-1. Declare a base class Animal, there are private integer member variable age, constructs its derived classes dog, in its member functions SetAge (int n) directly to the age assignment, to see what the problem is, the age to public member variables, there will be questions? Programming try. (2) declare a base class BaseClass, there is an integer member variable Number, construct its derived classes DerivedClass, observe the constructor and destructor implementation. 3 Declare a car (vehicle) base class, with MaxSpeed, Weight and other member variables, Run, Stop and other member functions, and derives a bike (bicycle), automobiles (motorcar) classes. Bike (bicycle) class has height (Height) and other attributes, automotive (motorcar) class has seats (SeatNum) and other attributes. Derived from the bicycle and motorcar motorcycle (motorcycle) class in the inheritance process, pay attention to the vehicle is set to the virtual base class. If you do not set the vehicle to the virtual base
(系统自动生成,下载前可以参看下载内容)
下载文件列表
7_1
...\7_1.cpp
...\7_1.dsp
...\7_1.dsw
...\7_1.ncb
...\7_1.opt
...\7_1.plg
...\Debug
...\.....\7_1.exe
...\.....\7_1.obj
...\.....\7_1.pdb
...\.....\StdAfx.obj
...\.....\vc60.pdb
...\ReadMe.txt
...\StdAfx.cpp
...\StdAfx.h
7_2
...\7_2.cpp
...\7_2.dsp
...\7_2.dsw
...\7_2.ncb
...\7_2.opt
...\7_2.plg
...\Debug
...\.....\7_2.exe
...\.....\7_2.obj
...\.....\7_2.pdb
...\.....\StdAfx.obj
...\.....\vc60.pdb
...\ReadMe.txt
...\StdAfx.cpp
...\StdAfx.h
7_3
...\7_3.cpp
...\7_3.dsp
...\7_3.dsw
...\7_3.ncb
...\7_3.opt
...\7_3.plg
...\Debug
...\.....\7_3.exe
...\.....\7_3.obj
...\.....\7_3.pdb
...\.....\StdAfx.obj
...\.....\vc60.pdb
...\ReadMe.txt
...\StdAfx.cpp
...\StdAfx.h