InterviewSolution
| 1. |
How Do C++ Struct Differs From The C++ Class? |
|
Answer» C++ defines structures and classes ALMOST identically. To declare a class, you USE the class keyword in place of the struct keyword. The only other differences are related to the default access SPECIFIERS. The members of a structure have public access by default; WHEREAS, the member of a class has private access by default. The concept of ENCAPSULATION is supported by the class only and not the structure. C++ defines structures and classes almost identically. To declare a class, you use the class keyword in place of the struct keyword. The only other differences are related to the default access specifiers. The members of a structure have public access by default; whereas, the member of a class has private access by default. The concept of encapsulation is supported by the class only and not the structure. |
|