class basics
What is the syntax for handling an object from class TWO in class ONE
for example if the object in class TWO is called object and it has a private member X
and that in the header file for class ONE, a private member is declared as :
TWO object;
How do you refer to members of the class TWO object in the implementation file for class ONE.
do you say for example
object.x to refer to member x?
or simply x ?
or something else?
Also if you have an array of objects defined in a class
How do you delete one of the objects in the array.
thanks for any help.
[625 byte] By [
CTS] at [2007-11-11 7:55:49]

# 2 Re: class basics
thanks
you put two .. after the x
but I am assuming it's just a typo and not special syntax
in other words it's object.x
so same syntax as calling an object from another object
thanks again
CTS at 2007-11-11 21:02:41 >

# 3 Re: class basics
class ONE
{
TWO obj;
public:
void func() { obj.x=6; }
};
You refer to any member of object X in the form obj.x, assuming that obj is an instance of X. However, since TWO declares x as private, members of class ONE can't access obj.x directly anyway. Only punlic members are accessible to it.
Danny at 2007-11-11 21:03:51 >
