文件名称:CPPexam7zip
-
所属分类:
- 标签属性:
- 上传时间:2013-11-22
-
文件大小:819.43kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
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/7_1.cpp
7_1/7_1.dsp
7_1/7_1.dsw
7_1/7_1.ncb
7_1/7_1.opt
7_1/7_1.plg
7_1/Debug/
7_1/Debug/7_1.exe
7_1/Debug/7_1.obj
7_1/Debug/7_1.pdb
7_1/Debug/StdAfx.obj
7_1/Debug/vc60.pdb
7_1/ReadMe.txt
7_1/StdAfx.cpp
7_1/StdAfx.h
7_2/
7_2/7_2.cpp
7_2/7_2.dsp
7_2/7_2.dsw
7_2/7_2.ncb
7_2/7_2.opt
7_2/7_2.plg
7_2/Debug/
7_2/Debug/7_2.exe
7_2/Debug/7_2.obj
7_2/Debug/7_2.pdb
7_2/Debug/StdAfx.obj
7_2/Debug/vc60.pdb
7_2/ReadMe.txt
7_2/StdAfx.cpp
7_2/StdAfx.h
7_3/
7_3/7_3.cpp
7_3/7_3.dsp
7_3/7_3.dsw
7_3/7_3.ncb
7_3/7_3.opt
7_3/7_3.plg
7_3/Debug/
7_3/Debug/7_3.exe
7_3/Debug/7_3.obj
7_3/Debug/7_3.pdb
7_3/Debug/StdAfx.obj
7_3/Debug/vc60.pdb
7_3/ReadMe.txt
7_3/StdAfx.cpp
7_3/StdAfx.h
7_1/7_1.cpp
7_1/7_1.dsp
7_1/7_1.dsw
7_1/7_1.ncb
7_1/7_1.opt
7_1/7_1.plg
7_1/Debug/
7_1/Debug/7_1.exe
7_1/Debug/7_1.obj
7_1/Debug/7_1.pdb
7_1/Debug/StdAfx.obj
7_1/Debug/vc60.pdb
7_1/ReadMe.txt
7_1/StdAfx.cpp
7_1/StdAfx.h
7_2/
7_2/7_2.cpp
7_2/7_2.dsp
7_2/7_2.dsw
7_2/7_2.ncb
7_2/7_2.opt
7_2/7_2.plg
7_2/Debug/
7_2/Debug/7_2.exe
7_2/Debug/7_2.obj
7_2/Debug/7_2.pdb
7_2/Debug/StdAfx.obj
7_2/Debug/vc60.pdb
7_2/ReadMe.txt
7_2/StdAfx.cpp
7_2/StdAfx.h
7_3/
7_3/7_3.cpp
7_3/7_3.dsp
7_3/7_3.dsw
7_3/7_3.ncb
7_3/7_3.opt
7_3/7_3.plg
7_3/Debug/
7_3/Debug/7_3.exe
7_3/Debug/7_3.obj
7_3/Debug/7_3.pdb
7_3/Debug/StdAfx.obj
7_3/Debug/vc60.pdb
7_3/ReadMe.txt
7_3/StdAfx.cpp
7_3/StdAfx.h
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.