I understand what typical access specifiers are and what they mean. "Public" members are available anywhere, 'private' members are available only to one class and friends, etc.
What I am interested in is that, if something, it equates to lower levels. Are there any functional differences after compiling between them beyond the high-level restrictions (which can get access to what) imposed by the language (in this case, C ++). They are used.
Another way to express this is if it were an ideal world where programmers always made good choices (for example, not referring to members who can change later and using only clearly defined members that should remain unchanged between implementations), whether they Any reason to use these things?
Access specifiers exist only for compilation purposes. Any memory within your distribution of programs can be accessed by any part of the executable file; no public / private concept at run time
Michael answers correctly. Access specifiers do not directly affect the received code.
/, .
class A { private: int x; }; class B { protected: int x; }; class C : public A, public B { public: int &get_x() { return x; } // only B::x is accessible, no error. };
, .
, . , , .
, . - , , .
. , c++ -Dprotected=public -Dprivate=public file.cc, ( , ).
c++ -Dprotected=public -Dprivate=public file.cc
(), "public" "private" ( , ..). ( ), , . \ ( , ) , , . , , .
, , , - private, , ( , , ). , ? ? ? () , , ( ).
private
Source: https://habr.com/ru/post/1743852/More articles:Internet Explorer 8 - Div disappears when resized - htmlSimple Pascal Types - pascalradio button loses value in postback - c #Eclipse CORBA Plugin - eclipseProblem using gson with Android in Eclipse - androidAlfresco: find related working copy of node - javascriptMapkit: show only annotations as they are - iphoneTrying to focus on JTextPane after double-clicking on a JList (Java) element - javahttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1743857/does-tomcat-compile-servlets-automatically&usg=ALkJrhjQp6bL2ToRpmBlY1-q5sxCOZNCkQA very interesting MYSQL problem (related to indexing, millionth records, algorithm). - mysqlAll Articles