//We made a header file for a car class #Ifndef CAR_H #define CAR_H //naming convention Class car { private: int speed; int miles; Public: car(int , int ); int Getspeed(); }; #endif //Then a source file //And include it #include "car.h" Car:: car(int s,int m){ Speed =s; Miles =m; } Into car::getspeed(){ return speed; } //Then another program to test car source Program #Include <iostream> #Include <car> using namespace std; Int main{ Car c1= new car(50,100); Cout<<"the speed is"<< c1.getspeed()<<endl; } //an interesting note is scope operator in comparison to ternary operator //http://www.cplusplus.com/forum/articles/14631/