suppose we have a class as
class integer
{
int m, n;
public:
integer ()
{m=0;n=0}
integer (integer & i)
{m=i.m; n=i.n}
MY QUES IS THAT m and n ARE PRIVATE MEMBERS OF CLASS; THEN HOW IS AN OBJECT i OF CLASS HAVING DIRECT ACCESS TO IT???
HELP
m and n are private but in their class they can be accessed
m and n are private members which can de accessed only by member functions of class,,
objects of class can have acess to only public members directly
m and n are private members which can de accessed only by member functions of class,,
objects of class can have acess to only public members directly
that object is used in a member function, if you try to access to m or n outside your class you will get an error
Sorry Prital your understanding is somewhat off.
Bazzy is right.
Basically a member function can access any member (of any object) of that class
Basically the class is allowed to do whatever it wants to itself. Public, protected and private only apply to outside interference.
Also what does this have to do with a copy constructor?
And its not good practice to ask a question then argue with the answer if you don't know it
Last edited on
thaks bazzy and guestgulkan, i got it now