c++: casting a parent class to a subclass and calling a subclass's function

前端 未结 0 1683
谎友^
谎友^ 2021-02-18 19:57

I have a parent class called A, and a subclass called B.
B has method printB();

Why can I c-style cast an A pointer to a B pointer and access method printB()? even

相关标签:
回答
  • 消灭零回复
提交回复
热议问题