"dost" <ka**************@gmail.comwrote:
In a class private section we can access the private data
member in main through the pointers.
Only if you did some evil casting stuff, using knowlege
of the size of the class, the size of the data members,
and what padding or packing is being used.
But if you're going to violate encapsulation, then why use
"private" to begin with? Just use a struct, with no access
specifiers, so all the members are public.
Is their any way to access the member functions which
are written in private section?
Not directly. You'd have to do that through a function
declared in the "public" section of your class.
So why not make your functions "public" and data "private"?
Let your member functions do the work on the data and report
their results back to the outside world. That's the usual
way to do OOP.
--
Cheers,
Robbie Hatley
Tustin, CA, USA
lonewolfintj at pacbell dot net
(put "[usenet]" in subject to bypass spam filter)
http://home.pacbell.net/earnur/