I have been given an assignment for university where i have to read from a pdf file and print to it as well. The coding part of the assignment is straight forward enough; the only trouble is that I don’t know what I could make as the superclass at the top of my inheritance chart.
Would I be right in making it a “create GUI” class which contains all the basic components such as the frame, the container, the font, and the button size and adding the methods to create instances of that class, or is that a totally useless class?
Please do not use inheritance at all if you can help it!
Am I a technophobe? No. Do I have repressed child/parent issues? Maybe, but that’s another post.
Creating an inheritance relationship is not one that should be done lightly, if at all. The main reason you need to create a new parent is if you need to describe the behaviour or attributes of a new category of objects from a general point of view. The idea of inheriting because you want to specialize (vehicle/car) is really meant to give students an idea for why the feature is in the language i.e. a way to grasp the concept, not an example of the logic used to decide when it is needed.
From a previous discussion of why the “vehicle/car’ example is extremely flawed:
Summary
1) Inheritance is a complex topic
2) Using a simple example to introduce a complex topic is admirable
3) Using an incorrect example creates students who, among other possibilities, try to extend the example and become confused or have a false sense of their understanding of the subject.
4) Using a bad example in class materials is inexcusable for a teacher who claims they understand the subject and who care about what the students get out of the class.