class MA { public: int DM1; void FM1(); };
If we have an object of type MA:
MA object1;then the members may be accessed (since they have public access control) by:
object1.DM1which is an expression whose value is the value of member
DM1
inside the object object1
,
and
object1.FM1()which is a call to member function
FM1
for object object1
. FM1
has direct access
to the values inside object1
, i.e. the value of DM1
.
Class members can also be accessed through pointers, using the ->
operator:
MA *pObject1 = &object1; pObject1->DM1 pObject1->FM1()
Copyright © 2003 Roger Hartley