Calling private method in C++

后端 未结 12 2156
忘了有多久
忘了有多久 2020-11-27 20:02

This is purely a theoretical question, I know that if someone declares a method private, you probably shouldn\'t call it. I managed to call private virtual methods and chang

12条回答
  •  抹茶落季
    2020-11-27 20:47

    Well, the obvious way would be to edit the code so that it is no longer private.

    If you insist on finding an evil way to do it...well...with some compilers it may work create your own version of the header file where that one method is public instead of private. Evil has a nasty way of rebounding on you though (that's why we call it "evil").

提交回复
热议问题