C++ pure virtual function have body [duplicate]
问题 This question already has answers here : Pure virtual function with implementation (8 answers) Closed 6 days ago . Pure virtual functions (when we set = 0 ) can also have a function body. What is the use to provide a function body for pure virtual functions, if they are not going get called at all? 回答1: Your assumption that pure virtual function cannot be called is absolutely incorrect. When a function is declared pure virtual, it simply means that this function cannot get called dynamically