![]() |
C++ struct vs class hi i am interested to know the the difference between C++ struct and class? can any one tell me ? I heard you could create a class in another way: struct: Quote:
thank you |
Re: C++ struct vs class A class is actually a special structure, if you want, an improved structure (as c + + is an enhancement of c),there is in the classroom compared to the structures are: -The classes contain functions (methods). -The classes offer access rights (encapsulation). -The classes are the basis for OOP in C + +. and finally, a class can contain one or more structures. |
Re: C++ struct vs class Access specifier is difference but as security is concern, this is a drawback of structure. Because for outside members are open by default to all. That is the one main reason, why programmers not use structure. where in class encourages encryption/data-hiding by default. So better to use class, than structure. |
Re: C++ struct vs class For the difference between struct and class in C + + I can confirm the only difference is that struct defaults to public and private class ... that's all. when the encapsulation, it may well have access to members of the class directly without using the methods, the only thing is that we should not do it when the class guaranteed tips. Example: Quote:
For if it was against a date, there are verification to do Quote:
The must use encapsulation to ensure its validity. Quote:
|
All times are GMT +5.5. The time now is 05:26 AM. |