Examine the following program. Select all line(s) which could go in "//code goes here" that would NOT cause a compiler e
Posted: Fri Apr 29, 2022 8:04 am
Examine the following program. Select all line(s) which could go in "//code goes here" that would NOT cause a compiler error, or "None of these" if they would all cause a compiler error. Pay careful attention to the access modifiers. Class Plant{ public: Plant(); int leaves; protected: int roots; private: int flowers; class Fern: public Plant{}; class Fiddlehead: public Fern{ void grow() { //code goes here }; undefined leaves++; roots++; flowers++; None of these
Examine the following program. Select all line(s) which could go in "//code goes here" that would NOT cause a compiler error, or "None of these" if they would all cause a compiler error. Note the use of private inheritance. class Plant{ public: Plant(); int leaves; protected: int roots; private: int flowers; class Fern: private Plant{}; class Fiddlehead: public Fern{ }; int main(){ Fiddlehead fh; //code goes here return 0; undefined O int leaves = fh.leaves; O int roots = fh.roots; Oint flowers = fh.flowers; None of these.
Examine the following program. Select all line(s) which could go in "//code goes here" that would NOT cause a compiler error, or "None of these" if they would all cause a compiler error. Note the use of private inheritance. class Plant{ public: Plant(); int leaves; protected: int roots; private: int flowers; class Fern: private Plant{}; class Fiddlehead: public Fern{ }; int main(){ Fiddlehead fh; //code goes here return 0; undefined O int leaves = fh.leaves; O int roots = fh.roots; Oint flowers = fh.flowers; None of these.