Question: Consider the following code snippet: ` ` ` class BaseClass { public: BaseClass ( ) ; virtual void set _ data ( int new _
Consider the following code snippet:
class BaseClass
public:
BaseClass;
virtual void setdataint newdata;
private:
int data;
;
BaseClass::BaseClass
data;
void BaseClass::setdataint newdata
cout "BaseClass setdata" endl;
class DerivedClass : public BaseClass
public:
virtual void setdataint newdata;
;
void DerivedClass::setdataint newdata
cout "DerivedClass setdata" endl;
int main
BaseClass bs new BaseClass;
DerivedClass ds new DerivedClass;
bs ds;
bssetdata;
return theta;
What is the output?data is the output.
BaseClass setdata is the output.
DerivedClass setdata is the output.
There is no output because there are compilation errors.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
