C++ Classes and Structures

Structure is similar to Class except for the fact that in structure declaration, all the members are public otherwise specified as private.

For example –

struct employee{
       void set_name(char *n);
       void getname(char *n);
       private:
        double wages;
     };

main(){
        employee Ted;
}

Add a Comment

Your email address will not be published. Required fields are marked *