0
class Vehicle{
long Number;
int Year;
char *Make,*Model,*BodyStyle,*Color;
float Cost;
friend ostream & operator<<(ostream& stream,const Vehicle& v);
class TruckVehicle:public Vehicle{
int Passengers;
long Mileage,GrossWeight,TempGross;
char *PoweredBy;
friend ostream & operator<<(ostream& stream,const TruckVehicle& t)
의로 기본 클래스의 오버로딩 함수를 호출 할 ?? 답장을 보내 주시면 대단히 감사하겠습니다. 간단하고 깨끗한 방법은이 작업을 수행하는어떻게 위의 코드에서 파생 된 클래스
친구 ostream에 & 연산자 << (ostream에 & 스트림 CONST TruckVehicle 및 t) {// CONST 차량 & v(t); 스트림 << static_cast(t); 스트림 << "번호"<< t.Number << endl; 나는 이것을 시도했다. 그러나 Number가 Vehicle 클래스의 개인 멤버라고 말하고있다. 이것에 대해 무엇을 제안하나요? –
Yourfavouritenoob
'가상 ostream & put (ostream & s) const = 0;'그리고'const Base b'? –