Ask Question
11 August, 14:01

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. 11 August, 15:28
    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?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers