Question: 9. In the following code, indicate if the selected lines are legal or illegal: #include class small { public: private: }; small() void k()

 9. In the following code, indicate if the selected lines are legal  

9. In the following code, indicate if the selected lines are legal or illegal: #include class small { public: private: }; small() void k() const; void h(int i); friend void f(small z); int size; }; void small::k() const { {size = 0;}; small x, Yi y; // LEGAL/ILLEGAL? x.size = y.size; // LEGAL/ILLEGAL? x.size = 3; // LEGAL/ILLEGAL? }; void small::h(int i) { }; void f(small z) { small x, yi x = y; // LEGAL/ILLEGAL? x.size = y.size; // LEGAL/ILLEGAL? x.size = 3; // LEGAL/ILLEGAL? x.h(42); // LEGAL/ILLEGAL? int main() { small x, Yi x = y; // LEGAL/ILLEGAL? x.size = y.size; // LEGAL/ILLEGAL? x.size = 3; // LEGAL/ILLEGAL? x.h(42); // LEGAL/ILLEGAL? std::cout < < "Hello, World! ";

Step by Step Solution

3.38 Rating (157 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Lets analyze every line of code 1 X y LEGAL This line is prison due to the fact each x and y are gad... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!