The objectives of this lab are to:
In this step, you will create version 5 of the Network system (our menu driven messaging system). In this version, you will use abstraction in the inheritance hierarchy.
In Eclipse, create a new project called Network-V5.
Copy the following classes into this new project:
Make the Post class abstract and add an abstract method called displayExcerpt() to it. The return type of this method should be a String.
In Post's subclasses, provide the concrete implementation for this method.
Message Post code:
public String displayExtract()
{
return "Message extract "+ message.substring(0,10) + "....";
}
public String displayExtract()
{
return "Photo caption: " + caption.substring(0,10) + "....";
}
Save your code.
Note that this code does not "do" anything as we have not called the displayExtract method from anywhere. This is just a very short lab to illustrate the abstract class and method concept.
Solution: Network-V5