![]() |
Accessing private variables...
Hello, I am having problems accessing a private variable within my class. I have it setup like this:
:
class MyClass {Is it possible for me to set myVariable through the constructor OtherClass()? OtherClass is supposed to set var1 and var2 to -1 and if possible set myVariable. Oh, and I was also wondering if there was a library function out there to sort an array of strings into alphabetical order. Any input is greatly appreciated, thanks. |
A nested class does not get special access privileges to the enclosing class.
|
The nested class can be declared as a friend if necessary.
However, a design that relies on an nested class accessing private members of a containing class is seriously broken. |
| All times are GMT -5. The time now is 2:05 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC