You have:
- identified two entities (classes):
Book
andMainScreen
- and then you identified common behavior and attributes of these classes
Yet you came with very wrong conclusion, that these classes should inherit from each other (i.e. provide some behavior / attributes to each other). What you should do instead is create a third class that these classes will inherit (whatever they are meant to have in common) from.
A possible interface-based approach could be for example:
class Displayable {
public:
virtual void display();
};
class Book : public Displayable {
...
};
class MainScreen : public Displayable {
...
};