Question: Why are Plant objects referenced by pointers in the Garden class? * public:virtual ~Garden ( ) ; protected:GrowingPlan repPlan; } ;The lifetime of a garden
Why are Plant objects referenced by pointers in the Garden class? public:virtual ~Garden;
protected:GrowingPlan repPlan;
;The lifetime of a garden and its plants are independent.
The lifetime of a garden and its plants are the same.
The use of pointers take up more storage than values.
Pointers are used because we are not aggregating other objects in the Garden class.
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
