C++ examples for Class:Class Creation
Having a HAS_A Relationship
class Vehicle {}; class Motor {}; class Car : public Vehicle { public: Motor motor; }; void VehicleFn(Vehicle& v); void MotorFn(Motor& m); int main(int nNumberofArgs, char* pszArgs[]) { Car car; VehicleFn(car); // this is allowed //MotorFn(car); // this is not allowed MotorFn(car.motor);// this is allowed return 0; }