Explanation of Solution
Given: The network project version and the display method is in the Post class.
To find:
The display method is shifted into the class MessagePost and PhotoPost.
The result on compilation of the program.
Solution:
The program shows compile time error after shifting the display() method from Post class to MessagePost and PhotoPost.
The MessagePost and PhotoPost are the subclasses of Post class. The private members can access only from the member function of the same class. The display() method tries to access the private members of the Post class from the subclasses MessagePost and PhotoPost. Therefore, it shows compile time error. A public member function created in the Post class and calling that from the display method removes error.
It also shows error in NewsFeed class because the NewsFeed class calls the display() method with the object of type Post and the display method is not in the Post class. Hence, it shows compile time error.
Want to see more full solutions like this?
- Open the clock-display project and create a ClockDisplay object by selecting the following constructor: new ClockDisplay() Call its getTime method to find out the initial time the clock has been set to. Can you work out why it starts at that particular time?arrow_forwardWrite the code for the timeTick method in ClockDisplay that displays hours, minutes, and seconds, or even implement the whole class if you wish.arrow_forwardWrite a button-click method to retrieve the value from an EditText and send it to another activity called SecondActivity. Then, write an onCreate method to retrieve the value sent from MainActivity to SecondActivity.arrow_forward
- Instead of generating the thing by putting together a set of lines, the designer of a solid model may instead build the object by molding and sculpting it. Explain?arrow_forwardWrite a method in the linkedBag class that gets an item of type T and finds out how many of the items in the linkedBag are bigger than that item. Return that count. Using Java Compilerarrow_forwardLook at the case in the piece and decide if the waterfall method is right for your project.arrow_forward
- How is this done without the use of itemgetter?arrow_forwardMy code won't print out the desired test cases. For instance, the time and the event did not properly store it in the skiplistmap class, so it prints out none regardless of time and event. Also, when printing out the skiplist, it will just print out empty for each level regardless of the time and event being stored. So, can you take a look at my code and fix it? Also, how do I use a FakeRandheight class for put(k, v)? mport java.io.File;import java.io.FileNotFoundException;import java.util.Scanner;public class HW5 {public static void main(String[] args) throws FileNotFoundException {SkipListMap<Integer, String> slm = new SkipListMap<>();SkipListMap<Integer, String> cancelEvents = new SkipListMap<>();File input = new File(args[0]);Scanner in = new Scanner(input);while (in.hasNextLine()) {String line = in.nextLine();String[] parts = line.split(" ");if (parts.length == 0) {continue;}String check = parts[0];if (check.equals("AddEvent")) {if (parts.length < 3)…arrow_forwardFind examples of javadoc key symbols in the source code of the TechSupport project. How do they influence the formatting of the documentation?arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education