RAD Studio
ContentsIndex
PreviousUpNext
Member Scope

This section contains Member Scope topics.

Name 
Description 
When you declare a derived class D, you list the base classes B1, B2, ... in a comma-delimited base-list:  
Members of a class acquire access attributes either by default (depending on class key and declaration placement) or by the use of one of the three access specifiers: public, private, and protected. The significance of these attributes is as follows:
  • public: The member can be used by any function.
  • private: The member can be used only by member functions and friends of the class it’s declared in.
  • protected: Same as for private. Additionally, the member can be used by member functions and friends of classes derived from the declared class, but only in... more 
The expression X::func() in the example in Inline functions and exceptions uses the class name X with the scope access modifier to signify that func, although defined “outside” the class, is indeed a member function of X and exists within the scope of X. The influence of X:: extends into the body of the definition. This explains why the i returned by func refers to X::i, the char* i of X, rather than the global int i. Without the X:: modifier, the function func would represent an ordinary non-class function, returning the global int i.
All member functions, then,... more 
Tag or typedef names declared inside a class lexically belong to the scope of that class. Such names can, in general, be accessed only by using the xxx::yyy notation, except when in the scope of the appropriate class.
A class declared within another class is called a nested class. Its name is local to the enclosing class; the nested class is in the scope of the enclosing class. This is a purely lexical nesting. The nested class has no additional privileges in accessing members of the enclosing class (and vice versa).
Classes can be nested in this way to an... more 
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!