본문내용
mber(int n)
{
number = n;
}
void setName(string n)
{
name = n;
}
int getNumber()
{
return number;
}
string getName()
{
return name;
}
};
class GraduateStudent : public Student{
public:
string lab;
void setLab(string l)
{
lab = l;
}
string getLab()
{
return lab;
}
};
Student(int number, string name)
{
this->number = number;
this->name = name;
}
GraduateStudent(int number, string name, string lab):Student(number,name)
{
this->lab = lab;
}
ⓐ
5. 다음 코드에서 오류를 찾으시오.
class Bike
{
private:int price;
protected:int gear;
public:int speed;
};
class MountainBike : public Bike
{
private:int seatHeight;
public:int maxGear;
};
int main()
{
Bike b;
MountainBike mb;
b.price = 10000;
b.gear = 1;
b.speed = 0;
mb.gear = 3;
mb.speed = 30;
mb.seatHeight = 65;
mb.maxGear = 8;
return 0;
}
6. 다음 프로그램의 출력을 쓰시오.
{
number = n;
}
void setName(string n)
{
name = n;
}
int getNumber()
{
return number;
}
string getName()
{
return name;
}
};
class GraduateStudent : public Student{
public:
string lab;
void setLab(string l)
{
lab = l;
}
string getLab()
{
return lab;
}
};
Student(int number, string name)
{
this->number = number;
this->name = name;
}
GraduateStudent(int number, string name, string lab):Student(number,name)
{
this->lab = lab;
}
ⓐ
5. 다음 코드에서 오류를 찾으시오.
class Bike
{
private:int price;
protected:int gear;
public:int speed;
};
class MountainBike : public Bike
{
private:int seatHeight;
public:int maxGear;
};
int main()
{
Bike b;
MountainBike mb;
b.price = 10000;
b.gear = 1;
b.speed = 0;
mb.gear = 3;
mb.speed = 30;
mb.seatHeight = 65;
mb.maxGear = 8;
return 0;
}
6. 다음 프로그램의 출력을 쓰시오.
추천자료
CH10_ EXERCISE
C++ ESPRESSO(에스프레소) PART 03 - CHAPTER 13 EXERCISE(엑서사이즈) 6개
C++ ESPRESSO(에스프레소) PART 03 - CHAPTER 11 EXERCISE(엑서사이즈) 7개
C++ ESPRESSO(에스프레소) PART 03 - CHAPTER 12 PROGRAMMING(프로그래밍) 6개
C++ ESPRESSO(에스프레소) PART 03 - CHAPTER 11 PROGRAMMING(프로그래밍) 5개
C++ ESPRESSO(에스프레소) PART 02 - CHAPTER 09 PROGRAMMING(프로그래밍) 9개
C++ ESPRESSO(에스프레소) PART01 - CHAPTER 01 EXERCISE(엑서사이즈) 10개
C++ ESPRESSO(에스프레소) PART01 - CHAPTER 02 PROGRAMMING(프로그래밍) 12개
C++ ESPRESSO(에스프레소) PART01 - CHAPTER 02 EXERCISE(엑서사이즈) 6개
C++ ESPRESSO(에스프레소) PART01 - CHAPTER 02 PROGRAMMING(프로그래밍) 6개
소개글