how to declares a class type?

In msdn, the explain of the class keyword is:

The class keyword declares a class type or defines an object of a class type.

class [tag [: base-list ]]
{
   member-list
} [declarators];
[ class ] tag declarators;

The elements of a class definition are as follows:

tag
Names the class type. The tag becomes a reserved word within the scope of the class.

 

i want to know how to use the tag to declare a class's type.

Thanks!



Answer this question

how to declares a class type?

  • timdilbert

    Just choose a valid name:

    class CDog
    {
    public:
        void Bark();
    };

    This name is used to define/create a object og this type:

    void Foo()
    {
        CDog dog;
        dog.Bark();
    }



  • how to declares a class type?