class [C++ Reference]
Keywords: keywords,class
Date: 2010-04-08T09:20:31-0700

## class

Syntax:

        class class-name : inheritance-list {
            private-members-list;
          protected:
            protected-members-list;
          public:
            public-members-list;
        } object-list;

The class keyword allows you to create new classes. class-name is the name of the class that you wish to create, and inheritance-list is an optional list of classes inherited by the new class.

Members of the class are private by default, unless listed under either the protected or public labels. object-list can be used to immediately instantiate one or more instances of the class, and is also optional.

For example:

         class Date {
           int Day;
           int Month;
           int Year;
         public:
           void display();
         };

Related Topics: friend, private, protected, public, struct, this, typename, union, virtual