是否有某种解决办法,或者我必须保持准确的类别?
纽约总部
Class Car {
public:
Car();
virtual ~Car();
};
class Bmw:Car {
public:
Bmw();
virtual ~Bmw();
};
void Start(Car& mycar) {};
页: 1
Car::Car(){}
Car::~Car() {}
Bmw::Bmw()
:Car::Car(){}
Bmw::~Bmw() {}
int main() {
Car myCar;
Bmw myBmw;
Start(myCar); //works
Start(myBmw); //!! doesnt work
return 0;
}