Try out your solution by creating a messagepost object


In order to illustrate that a subclass can access non-private elements of its superclass without any special syntax, try the following slightly artificial modification to the MessagePost and Post classes. Create a method called print Short Summary in the MessagePost class. Its task is to print just the phrase "Message post from NAME", where NAME should show the name of the author. However, because the username field is private in the Post class, it will be necessary to add a public getUserName method to Post. Call this method from print Short Summary to access the name for printing. Remember that no special syntax is required when a subclass calls a superclass method. Try out your solution by creating a MessagePost object. Implement a similar method in the PhotoPost class.

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Try out your solution by creating a messagepost object
Reference No:- TGS02169402

Expected delivery within 24 Hours