subject
Computers and Technology, 24.04.2020 15:45 yfnal3x

Write the PrintItem() function for the base class. Sample output for below program:

Last name: Smith
First and last name: Bill Jones

#include
#include
#include
using namespace std;
class BaseItem {
public:
void SetLastName(string providedName) {
lastName = providedName;
};
// FIXME: Define PrintItem() member function
/* Your solution goes here */
protected:
string lastName;
};
class DerivedItem : public BaseItem {
public:
void SetFirstName(string providedName) {
firstName = providedName;
};
void PrintItem() const override {
cout << "First and last name: ";
cout << firstName << " " << lastName << endl;
};
private:
string firstName;
};
int main() {
BaseItem* baseItemPtr = nullptr;
DerivedItem* derivedItemPtr = nullptr;
vector itemList;
unsigned int i; baseItemPtr = new BaseItem();
baseItemPtr->SetLastName("Smith" );
derivedItemPtr = new DerivedItem();
derivedItemPtr->SetLastName("Jon es");
derivedItemPtr->SetFirstName("Bi ll"); itemList. push_back(baseItemPtr); itemList. push_back(derivedItemPtr);
for (i = 0; i < itemList. size(); ++i) {
itemList. at(i)->PrintItem();
}
return 0;
}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 23:00
What computer network component allows data transfers from one computer to another through a telephone line?
Answers: 1
question
Computers and Technology, 22.06.2019 17:00
Acase study allows a more detailed look at the life of a single subject than any other study.
Answers: 3
question
Computers and Technology, 24.06.2019 02:30
Which option completes the explanation for conflict of interest in an organization
Answers: 1
question
Computers and Technology, 24.06.2019 05:30
Someone plzz me which of these defines a social search? a. asking a search engine a question that is answered by a real person on the other sideb. modifying search results based on popularity of a web pagec.modifying search results based on a ranking of a web page
Answers: 2
You know the right answer?
Write the PrintItem() function for the base class. Sample output for below program:

Las...
Questions
question
English, 03.11.2020 03:50
question
Mathematics, 03.11.2020 04:00
question
Mathematics, 03.11.2020 04:00
question
Biology, 03.11.2020 04:00
Questions on the website: 13722359