있나요??
Because that's how it works in C++. In C++ access control works on per-class basis, not on per-object basis.
Access control in C++ is implemented as a static, compile-time feature. I think it is rather obvious that it is not really possible to implement any meaningful per-object access control at compile time. Only per-class control can be implemented that way.
Some hints of per-object control are present in protected access specification, which is why it even has its own dedicated chapter in the standard (11.5). But still any per-object features described there are rather rudimentary. Again, access control in C++ is meant to work on per-class basis.
- c++은 그렇게 작동하게 되어 있음. C++ 접근 제어는 클래스를 단위로 하지 오브젝트(인스턴스)단위로 하지 않음.
c++의 접근 제어는 컴파일 타임에 정적으로 구현되어 있음. 컴파일 타임에 오브젝트 단위로 접근 제어를 구현하는 일은 딱히..
.......
그렇다
오브젝트 단위로 구현하기 힘든가 그냥 인스턴스 메모리 기준으로 멤버 메모리 위치 접근을 제어하면 되지 않나 - return 0;
구현하는 건 어렵지 않지만 의미가 없는 거 아님?
접근제어자는 컴파일 언어임
런타임에 의미를 안두게 설계한거라 오브젝트를 구분하지 아늠