Calling private method in C++

后端 未结 12 2158
忘了有多久
忘了有多久 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:54

    Define a similar class that is the same apart from the function being public.

    Then typecast an object with the private function to one with the public function, you can then call the public function.

提交回复
热议问题