#include <iostream>
#include <string>

using namespace std;

class Car
{
 int speed;
 int gear;
 string color;
public :
 Car() : speed(100), gear(6), color(\"Red\")
 {
  cout<<\"Car 디폴트 생성자 호출\"<<endl;
 }
 Car(int s, int g, string c)
 { 
  speed = s;
  gear = g;
  color = c;
  cout<<\"Car 생성자 호출\"<<endl;
 }
 Car(Car &obj) : speed(obj.speed), gear(obj.gear), color(obj.color)
 {
  cout <<\"Car 복사 생성자 호출\"<<endl;
 }
 
 void print()
 {
  cout <<\"속도: \"<<speed <<\" 기어: \"<<gear<<\" 색상 : \"<<color<<endl;
 }

 int speeddown(int speed)
 {
  this->speed -= speed;
  return speed;
 }
 void setspeed(int s_s)
 {
  speed = s_s;
 }
 void setgear(int s_g)
 {
  gear = s_g;
 }
 void setcolor(string s_c)
 {
  color = s_c;
 }
};

class test :public Car
{
public:
 test(int s, int g, string c) : Car(s, g, c)
 {
  setspeed(s);
  setgear(g);
  setcolor(c);
  cout <<\"test 생성자 포인터 호출\"<<endl;
 }
};

void main()
{
 
 Car c1(120, 4, \"Blue\"); //생성자 직접 지정
 Car c2(c1); //복사 생성자
 Car c3; //디폴트 생성자
 Car *pCar = new test(110, 2, \"Green\");
 c1.speeddown(30); //c1의 speed 값 하락
 c1.print();
 c2.print();
 c3.print();
 pCar->print();

}