文件名称:lab8
介绍说明--下载内容均来自于网络,请自行研究使用
1. 编写程序定义Point类,在类中定义整型的私有成员变量_x、_y,对Point类重载“++”(自增) “--”(自减)运算符,实现对坐标值的改变。
2. 编写程序定义一个车(vehicle)基类,有Run、Stop等成员函数,由此派生出自行车(bicycle)类、汽车(motorcar)类,从bicycle和motorcar派生出摩托车(motorcycle)类,它们都有Run、Stop等成员函数。观察虚函数的作用。
3. (选做)对实验2中的people类重载“= =”运算符和“=”运算符,“==”运算符判断两个people类对象的id属性是否相等;“=”运算符实现people对象的赋值操作
-1. Preparation process definition Point class defined in the class integer private member variables _x, _y, of the Point class overload "++"( increment) "--"( decrement) operator, to realize coordinates value changes.2. Write a program to define a car (vehicle) base class, with Run, Stop and other member functions, thus derived a bike (bicycle), automobiles (motorcar) class, derived from the bicycle and motorcar motorcycle (motorcycle) class, They all have Run, Stop and other member functions. Observe the role of virtual functions.3. (Elected to do) to Experiment 2 in the people category overloaded "= =" operator and "=" operator ,"==" operator to judge two people of the id attribute class object is equal "=" operator Fu realize people object assignment
2. 编写程序定义一个车(vehicle)基类,有Run、Stop等成员函数,由此派生出自行车(bicycle)类、汽车(motorcar)类,从bicycle和motorcar派生出摩托车(motorcycle)类,它们都有Run、Stop等成员函数。观察虚函数的作用。
3. (选做)对实验2中的people类重载“= =”运算符和“=”运算符,“==”运算符判断两个people类对象的id属性是否相等;“=”运算符实现people对象的赋值操作
-1. Preparation process definition Point class defined in the class integer private member variables _x, _y, of the Point class overload "++"( increment) "--"( decrement) operator, to realize coordinates value changes.2. Write a program to define a car (vehicle) base class, with Run, Stop and other member functions, thus derived a bike (bicycle), automobiles (motorcar) class, derived from the bicycle and motorcar motorcycle (motorcycle) class, They all have Run, Stop and other member functions. Observe the role of virtual functions.3. (Elected to do) to Experiment 2 in the people category overloaded "= =" operator and "=" operator ,"==" operator to judge two people of the id attribute class object is equal "=" operator Fu realize people object assignment
(系统自动生成,下载前可以参看下载内容)
下载文件列表
lab8\lab8_1.cpp
....\lab8_2.cpp
....\lab8_3.cpp
lab8
....\lab8_2.cpp
....\lab8_3.cpp
lab8