Ask Question

Write the printitem () method for the base class. sample output for below program: last name: smith first and last name: bill jones

+5
Answers (1)
  1. 3 September, 06:46
    0
    The question involves basic polymorphism. The following is the partial flow of the program.

    baseItemPtr = new BaseItem ();

    baseItemPtr. setLastName ("Smith");

    derivedItemPtr = new DerivedItem ();

    derivedItemPtr. setLastName ("Jones");

    derivedItemPtr. setFirstName ("Bill");

    itemList. add (baseItemPtr);

    itemList. add (derivedItemPtr);

    for (i = 0; i < itemList. size (); + + i) {

    itemList. get (i). printItem ();

    }

    return;
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write the printitem () method for the base class. sample output for below program: last name: smith first and last name: bill jones ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers