Question: #include class CarModel { private: long m _ id; public: CarModel ( long id ) : m _ id ( id ) { } long

#include
class CarModel
{
private:
long m_id;
public:
CarModel(long id)
: m_id(id)
{
}
long getID(){ return m_id; }
};
class EngineType
{
private:
long m_id;
public:
EngineType(long id)
: m_id(id)
{
}
long getID(){ return m_id; }
};
class StarterBattery: public CarModel, public EngineType
{
public:
StarterBattery(long carmodelId, long enginetypeId)
: CarModel(carmodelId), EngineType(enginetypeId)
{
}
};
int main()
{
StarterBattery c1857X(1984,205207);
std::cout << c1857X.getID();
return 0;
}
Whats the error of the code and the soultion to fix it

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!