Examples of Access Specifiers


/************************************************************************
*

The following example shows access specifiers in member lists.

                                                                        *
************************************************************************/


class X
{
      int a;             // private data by default
public:
      void f(int);       // public function
      int b;             // public data
private:
      int c;             // private data
protected:
      void g(int);       // protected function
};
struct Y
{
      int a;             // public data by default
public:
      int b;             // public data
private:
      void g(int);       // private function
      int c;             // private data
};