Hi All,
We can not access the data member of a class nested with in another class.It does not get instantiated also.So what are the use of having a class nested with in another class?
Thanks and Regards,
A
Hi All,
We can not access the data member of a class nested with in another class.It does not get instantiated also.So what are the use of having a class nested with in another class?
Thanks and Regards,
A
You can access the data, depending on whether it is visible from whatever scope you're in. I'm not sure what you mean by "it does not get instantiated".
If I'm understanding you, you mean something like std::list<T>::iterator ? Post some code, and we can hammer out any errors or troubles you might be having.
long time; /* know C? */
Unprecedented performance: Nothing ever ran this slow before.
Any sufficiently advanced bug is indistinguishable from a feature.
Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
The best way to accelerate an IBM is at 9.8 m/s/s.
recursion (re - cur' - zhun) n. 1. (see recursion)
The only change of a nested class is that it will be located inside the first class.
class A { class B {}; };
To create class B, you will need to do A::B someth;
What's the use? Consider if the class is only supposed to be use by the class it resides in, or if it makes sense to access it via A::B.
For example, in a linked list container, it makes sense to make the list node an inner class, because no one else has any business accessing that class.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
Nesting classes and structs within classes normally shows ownership. I don't do it very often.