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
Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new technology, they are send

what will be the c program for ideal gas equation.

write a program that adds all numbers from 1 to 200

Inbuilt Functions i).  Functions to manipulate strings The cstring library defines many functions to perform some manipulation operations with C-styled functions. The followi

In this problem, you will write a program that implements two algorithms for performing exact inference given a Bayesian network, namely, enumeration and variable elimination. Your

#questio A charitable organization wants to design a special ATM machine to be used by needy people. The association supplies the needy person with a pin number to be able to use

A: no, can't. The names of, precedence of, associativity of, and arity of operators is fixed through the language. In C++, there is no operator** so you cannot create one for a

What is MIME? MIME - Multi-purpose Internet Mail Extensions. MIME types signifies a standard way of classifying file types over Internet. Browsers and Web servers have

Question : (a) How does a structure differ from an array? (b) Describe how a structure differs from a union? (c) Declare a union called ‘clothes' which consists of the

define a class for student