Creating Superclass and subclass.
Both class should have 4 methods and the subclass should have additional properties/fields and a constructor. The subclass should have at least one method that overrides a method in the superclass. On another file is creating a manipulator where you use the subclass and all of its methods.

Thank you...I hope you can help me with this...

Recommended Answers

All 2 Replies

Creating Superclass and subclass.
Both class should have 4 methods and the subclass should have additional properties/fields and a constructor. The subclass should have at least one method that overrides a method in the superclass. On another file is creating a manipulator where you use the subclass and all of its methods.

Thank you...I hope you can help me with this...

If you've been given this assignment, you are not a complete beginner. Therefore you know enough to at least post SOME code and start the assignment.

Hi =)

I will give you an example to think about.
Let us say that you want to do a register of media.
First you create a superclass called Media. In this class you put the things that are common for all media regardless of what type of media it is. Name is one such thing that are common for all type of media. Maybe you want all your media to have a unique Id, then Id is also common for every type of media.

Every piece of media is also an object so it is obvious that you will need some set and get methods and some toString method should also be helpful.

Now lets suppose you have two kinds of media. we assume that you are an old fashion person and still are hanging on to VHS and of course you also have DVD. So now you make one subclass called VHS and one called DVD.

These subclasses have some common things like name and ID that they can inherit from the superclass Media. But they also have some unique things they do not share. And that has to be put in the subclass.

When you search for your media or want to make a list of it you can use a toSring method so the object is readable in a nice way. This method should maybe look different depending on what information your VHS-object holds versus your DVD-object.

This way to think can be used on many other objects.
Superclass Car, subclass Volvo and Saab.
Superclass Animal, subclass Horse and Cat.

Hope you got the idea.
Good luck =)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.