Project1 - #include<iostream> #include<string>...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#include<iostream> #include<string> using namespace std; u class Vehicle //base class { private: int age; //the age of the vehicle protected: float price; //the price of the vehicle public: Vehicle() //default constructor sets age=0, and price=0.0 { age=0; //I just defined all of my member functions within the classes w price=0.0; //themselves as opposed to using class scope operators somewhere } //else because the implementation is so short for each function ~Vehicle() { //destructor sets age=0, and price=0.0 age=0; price=0.0; } void setAge(int x) //takes an integer parameter, returns nothing { age=x; } void setPrice(float x) //takes a float parameter, returns nothing { price=x; } int getAge() //takes no parameters, returns the vehicle's age { return age; } float getPrice() //takes no parameters, returns the vehicle's price { return price; } }; } class Car : public Vehicle //derived class { public: bool RaceCarStatus; //boolean, is the car RaceCarStatus or not? Car() //default constructor sets RaceCarStatus=false
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

Project1 - #include&lt;iostream&gt; #include&lt;string&gt;...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online