Thursday, July 29, 2010

Can we declare a class inside a class ? C++\Java\Asp.Net

Yes..
 
At times you need to define a class only to serve other class and there are no other reasons to make it visible. The best way to implement this is through nested classes. A nested class is a class defined within the scope of another class.
Example:-

class OuterClass
{
...
class NestedClass
{
...
}
}

No comments:

Post a Comment