Access Control
Practice Questions
Consider the following definition:
class Fred
{
int size;
public:
Fred(int i) { size = i; }
int & Size() { return size; }
};
int m;
int *ip;
const int *cip;
Fred f(14);
Which is legal (will compile), and which is illegal?
*cip = m;
ip = cip;
cip = &m;
m = f.Size();
f.Size() = m;
f.size = m;
Fred f;
Bits and Pieces
Answer
Function Overloading