F
Faisal
Hi,
I've a class
class A
{
private:
int _mem;
public:
void foo(A a)
{
_mem = 0;
_a.mem = 0;//not showing access viloation error
}
};
In the above function I'm accessing object a's private member by
a._mem. Why c++ is not restricting private member access inside a
member fn
even if the object is different?
Is there any specific reason for this?
I've a class
class A
{
private:
int _mem;
public:
void foo(A a)
{
_mem = 0;
_a.mem = 0;//not showing access viloation error
}
};
In the above function I'm accessing object a's private member by
a._mem. Why c++ is not restricting private member access inside a
member fn
even if the object is different?
Is there any specific reason for this?