Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

6- Here is a small class definition: class small { public: small( ); void k() co

ID: 3728817 • Letter: 6

Question

6- Here is a small class definition:

    class small

    {

    public:

        small( );

        void k() const;

        void h(int i);

        friend f(Small z);

    private:

        int size;

    };

Suppose that x and y are both small objects. Write the word "legal" or "illegal" in each location of this table to indicate whether the indicated statement is legal or illegal in these locations:

Statement

In a main program

In the const member function k

In the friend function f

x = y;

.

.

.

x.size = y.size;

.

.

.

x.size = 3;

.

.

.

x.h(42);

.

.

.

Statement

In a main program

In the const member function k

In the friend function f

x = y;

.

.

.

x.size = y.size;

.

.

.

x.size = 3;

.

.

.

x.h(42);

.

.

.

Explanation / Answer

Statement

In a main program

In the const member function k

In the friend function f

x = y;

legal

legal

legal

x.size = y.size;

illegal

illegal

legal

x.size = 3;

illegal

illegal

legal

x.h(42);

legal

illegal

legal

Statement

In a main program

In the const member function k

In the friend function f

x = y;

legal

legal

legal

x.size = y.size;

illegal

illegal

legal

x.size = 3;

illegal

illegal

legal

x.h(42);

legal

illegal

legal

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote