C4700 is a warning, not an error. Your code compiles fine. It is just telling you that the members m_vitesse, m_portes, and m_prix are left uninitialized. If you want to initialize them, you’ll need to give those classes their own constructors, such as:
class Vehicule {
public:
// This constructor initializes m_prix to 0
Vehicule() : m_prix(0) { }
void affiche() const {
cout << "Ceci est un vehicule." << endl;
}
protected:
int m_prix;
};
3
solved My code does not compile for a strange reason [closed]