Use-cases of pure virtual functions with body?

前端 未结 7 1282
心在旅途
心在旅途 2020-11-30 23:24

I recently came to know that in C++ pure virtual functions can optionally have a body.

What are the real-world use cases for such functions?

7条回答
  •  心在旅途
    2020-12-01 00:16

    The only difference of virtual function with body and pure virtual function with body is that existence of second prevent instantiation. You can't mark class abstract in c++.

提交回复
热议问题