{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

001 - Program 1 Write a C program that produces one output...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Program 1:- Write a C++ program that produces one output if the keyword “virtual” is used in one specific place and produces a different output if that keyword is missing. You should submit a listing of your program with the keyword “virtual” highlighted and the two different outputs. Let me emphasize that your outputs should be generated by two versions of the same program whose only difference is in the absence or presence of one use of the keyword “virtual.” Solution:- #inc1ude <iostream> using namespace std; class Cty { public: virtual void equals(Cty C) 7—” cout << "This is equalsl of Base Class" << endl; }; class SCty : public Cty { public: ' void equals(Cty C) { cout << "TPHS IS EQUALSl OF SUB—CLASS" << endl; } void equals (SCty SC) { cout <§ "THIS IS EQUALSZ OF SUB-CLASS" << endl; } ...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online