class definitionthe following is the general


Class Definition

The following is the general format of defining a class template:

class tag_name

                 {

                   public  :               // Must

                                                type member_variable_name;

                                                :

                                                type member_function_name();

                                                :

                   private:                  // Optional

                                                type member_variable_name;

                                                :

                                                type member_function_name();

                                                :

                 };

The keyword class is used to explain a class template. The private and public sections of a class are given by the keywords 'private' and 'public' respectively. They determine the accessibility of the members. All the variables declared in the class, whether in the private or the public section, are the members of the class. As the class scope is private by default, you can also omit the keyword private. In such cases you must declare the variables before public, as writing public overrides the private scope of the class.

e.g.

class tag_name

                 {

       type member_variable_name;    // private

    :

           type member_function_name();  // private

      :

 public  :                                           // Must

                                                type member_variable_name;

                                                :

                                                type member_function_name();

                                                :

                 };

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: class definitionthe following is the general
Reference No:- TGS0309351

Expected delivery within 24 Hours