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
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.