0

I was going through a old code written by someone i encountered one class defined as

class SomenameofClass::Someanothername of the class
{

//some code goes here 
};

what does it mean ? does it signifies private inheritance ?

billz
  • 44,644
  • 9
  • 83
  • 100
  • 2
    http://stackoverflow.com/questions/4571355/why-would-one-use-nested-classes-in-c – NPE Oct 14 '14 at 06:38

3 Answers3

3

This is the definition of a nested class which was declared elsewhere like this:

class SomenameofClass
{
  class Someanothername;
};

Usually this is done when the nested class is only used in the implementation of the outer class, so its definition doesn't need to be exposed in a header file.

John Zwinck
  • 239,568
  • 38
  • 324
  • 436
1

Nested classes are considered to be within the scope of the enclosing class and are available for use within that scope. To refer to a nested class from a scope other than its immediate enclosing scope, you must use a fully qualified name.

Laura Maftei
  • 1,863
  • 1
  • 15
  • 25
0

Its nested class, these are used to avoid name conflicts among different scopes. If a class is used by only one class, nest it, it will avoid naming conflicts and you will be notified if there is any conflict by intellisense

Ali Kazmi
  • 1,460
  • 9
  • 22