C Language and Libraries Help (clang.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
public
                                             Up Contents Index Back
─────C/C++ Language─────────────────────────────────────────────────────────
 
  Keyword:   public
 
  Syntax:    public: [member-list]
             public base-class
 
  Summary:   When preceding a list of class members, specifies that
             those members are accessible from any function. Applies
             to all members declared up to the next access specifier
             or the end of the class.
 
             When preceding the name of a base class, specifies that
             the public and protected members of the base class are
             public and protected members, respectively, of the derived
             class.
 
  See also:  private, protected, friend
             Table of Access Privileges
 
     Default access of members in a class is private. Default access of
     members in a structure or union is public.
 
     Default access of a base class is private for classes and public
     for structures. Unions cannot have base classes.
 
     Example
 
         class BaseClass
         {
         public:
             int pubFunc();
         };
 
         class DerivedClass : public BaseClass
         {
         };
 
         void main()
         {
             BaseClass aBase;
             DerivedClass aDerived;
 
             aBase.pubFunc();       // pubFunc() is accessible
                                    //    from any function
             aDerived.pubFunc();    // pubFunc() is still public in
                                    //    derived class
         }
                                    -♦-