15_3.cpp
资源名称:c.rar [点击查看]
上传用户:puke2000
上传日期:2022-07-25
资源大小:912k
文件大小:0k
源码类别:
C#编程
开发平台:
Visual C++
- //15_3
- #include <iostream.h>
- class Boat;
- class Car{
- public:
- Car(int j){ size =j; }
- int Get(){ return size; }
- protected:
- int size;
- };
- class Boat{
- public:
- Boat(int j){ size =j; }
- int Get(){ return size; }
- protected:
- int size;
- };
- int Leisure(int time, Car& aobj, Boat& bobj)
- {
- return time * aobj.Get() * bobj.Get();
- }
- void main()
- {
- Car c1(2);
- Boat b1(3);
- int time =4;
- cout <<Leisure(time,c1,b1);
- }