oop - c++ implementation of access specifiers -


from understand, non-static data members in c++ class packed c-style struct. ignoring virtual functions , inheritance sake of simplifying discussion, how access-specifiers enforced in such scheme ?

say class:
class object { public: int i1; int i2; private: char i3; int i4; };

translates to: struct { int i1; int i2; char i3; int i4; }

how c++ ensure private members i3 , i4 can not accessed outside class i1 , i2 can be?

c++ has (some) safe guards protect against murphy, not machiavelli.

what means const, volatile , access-qualifiers checked at compilation time, can bypassed (with variety of tricks).

so... c++ not require implementing protection scheme. if program compiled, deemed correct (wrt qualifiers) , executed without runtime checks.


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -