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
Problem: (a) Distinguish between a class and an object. (b) Define instantiation. (c) What is the importance of the "this" variable in java. (d) What is encapsulation?

//Create a custom calculator program capable of reading the input stream of an expression //and make basic computations to provide answer. //Your program will ask the user to

how to decode the numerals to string..

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

Want a scraping program created Project Description: We need to hire a professional developer to scrape the site for information such as *product title *Product Price

Polymorphism C++ supports this idea - that different objects do "the right thing "- by function polymorphism and class polymorphism. Poly means many, while morph means form.

A string S is said to be "Super ASCII", if it contains the character frequency equal to their ascii values. String will contain only lower case alphabets (''a''-''z'') and the asci

Write a Program for Calculating Value of an Integer? For a clear understanding of recursive function we shall see an illustration for calculating value of an integer. main() {

what is binary heap ? what is the c code for the implementation for the binary heap