Question: Consider the following code: class flower { private: int petals; public: flower ( ) { petals = 6 ; void setPetals ( int newPetals )
Consider the following code:
class flower
private:
int petals;
public:
flower petals ;
void setPetalsint newPetalspetals newPetals;
virtual int getPetals return petals;
void displayPetals cout getPetals endl; ;
;
class daisy: public flower
public:
daisy setPetals;
int getPetalsreturn flower::getPetals;
;
int main
flower f;
daisy d;
fdisplayPetals;
ddisplayPetals;
return O;
J
Which of the following best describes the output?
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
