What benefits do C++ fictional functions bring to us?
Xiaobian to share with you what benefits C++ fictional functions bring to us, I believe most people do not know much about it, so share this article for your reference. I hope you will learn a lot after reading this article. Let's find out about it!
When we use C++ programming language for program development, we will gradually find that this language has brought great benefits to our program development. We know that when developing with C++, the C++ fictional functions used as base classes are generally virtual functions. But why do we have to do so? Here is a small example to illustrate:
There are two classes:
Class ClxBase
{
Public:
ClxBase () {}
Virtual ~ ClxBase () {}
Virtual void DoSomething () {cout