Is it possible to access the child’s function members from a pointer of an abstract class as the parent?
This is the abstract class
class Item {
public:
virtual double getTotalPrice() = 0;
};
This is the child class
class Product : public Item {
protected:
string name;
public:
Product() {}
string getName() {}
double getTotalPrice() {}
};
Is it possible in the main driver to access this getName() function from an instance of the Item class, as I want to display the total price and the name of the product also?
Source: Windows Questions C++