Write about a nested class and mention its use?



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

Post New Answer

More C++ General Interview Questions

Which compiler does turbo c++ use?

1 Answers  


Why iomanip is used in c++?

1 Answers  


what kind of projects are suitable for c and c++

1 Answers  


Where and why do I have to put the "template" and "typename" keywords?

1 Answers  


Array base access faster or pointer base access is faster?

1 Answers  


Why the usage of pointers in C++ is not recommended ?

1 Answers   TCS,


Differentiate between a pointer and a reference with respect to c++.

1 Answers  


What will happen if I allocate memory using "new" and free it using "free" or allocate sing "calloc" and free it using "delete"?

3 Answers  


Explain the need for "Virtual Destructor"?

2 Answers   Infosys,


What is nested class in c++?

1 Answers  


What do you mean by abstraction. Explain your answer?

5 Answers  


What are the types of pointer?

1 Answers  


Categories