Write about a nested class and mention its use?
Answer / Ganesh Prasad
A nested class is a class defined within another class. It allows you to create classes that are closely related and have access to the enclosing class's private members:
- A nested class can be either static or non-static. Static nested classes are associated with the class itself, while non-static nested classes are associated with specific objects of the enclosing class.
- Nested classes are useful for hiding implementation details and promoting abstraction. They help organize code and provide better encapsulation.
| Is This Answer Correct ? | 0 Yes | 0 No |
Which compiler does turbo c++ use?
Why iomanip is used in c++?
what kind of projects are suitable for c and c++
Where and why do I have to put the "template" and "typename" keywords?
Array base access faster or pointer base access is faster?
Why the usage of pointers in C++ is not recommended ?
Differentiate between a pointer and a reference with respect to c++.
What will happen if I allocate memory using "new" and free it using "free" or allocate sing "calloc" and free it using "delete"?
Explain the need for "Virtual Destructor"?
What is nested class in c++?
What do you mean by abstraction. Explain your answer?
What are the types of pointer?