Define nested class? why can it be useful?, C/C++ Programming

it is a class enclosed in the scope of another class. For illustration:

// Example: Nested class

//

class OuterClass

{

class NestedClass

{

// ...

};

// ...

};

Nested classes are helpful for organizing code and controlling dependencies and access. Nested classes obey access rules as other parts of class do; thus, in Example, if Nested Class is public then any code may name it as OuterClass::NestedClass. Frequently nested classes have private implementation details, and are thus made private; in Example, if NestedClass is private, then just OuterClass's members and friends can employ NestedClass. While you instantiate like outer class, it won't instantiate inside class.

 

Posted Date: 3/16/2013 3:02:04 AM | Location : United States







Related Discussions:- Define nested class? why can it be useful?, Assignment Help, Ask Question on Define nested class? why can it be useful?, Get Answer, Expert's Help, Define nested class? why can it be useful? Discussions

Write discussion on Define nested class? why can it be useful?
Your posts are moderated
Related Questions
write a pseudo code for computing sin(x) using sentinel control loop

What does this mean that "friendship isn't transitive, inherited or reciprocal"? A: As I grant you friendship access to me doesn't grant your kids automatically access to me, do

Can I free() pointers allocated  along with new? Can I delete pointers allocated along with malloc()? A: No. It is completely legal, moral, and wholesome to employ malloc() a

What I need is an auto-click bot. The auto-click bot would ask me for a url(or it would be pre-defined too) so that it loads that specific url and click an ad automatically. This w


A: Method of passing arguments to a function that takes parameter of type reference.  for instance: void swap( int & x, int & y ) { int temp = x; x =

color representation 0,1,2,3,4,5,6,7...

Project Description: I have a code that works different on 64 bit and 32 bit system. Code is relative to some crypt functions, similar, but not equal to: I have to move fr

A Padovan string P(n) for a natural number n is defined as: P(0) = ‘X’ P(1) = ‘Y’ P(2) = ‘Z’ P(n) = P(n-2) + P(n-3), n>2 where + denotes string concatenation. For a string of t

Explain about the Character Constants in c language? The character constant is a single alphabet and a single digit or a single special symbol enclosed within a pair of single