1 2 3 |
Derived derived(1.3, 5); // use Derived(double) constructor std::cout << "Id: " << getId() << '\n'; std::cout << "Cost: " << getCost() << '\n'; |
I think you meant:
1 2 3 |
Derived derived(1.3, 5); // use Derived(double) constructor std::cout << "Id: " << derived.getId() << '\n'; std::cout << "Cost: " << derived.getCost() << '\n'; |
In addition, there is no access function called getCost() in the definition of derived in that code snippet
1 |
double getCost() const { return m_cost; } |