Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 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

Step: 1

Lets analyze every line of code 1 X y LEGAL This line is prison due to the fact each x and y are gad... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java How To Program Late Objects Version

Authors: Paul Deitel, Deitel & Associates

8th Edition

0136123716, 9780136123712

More Books

Students also viewed these Programming questions