what's polymorphic type in C++?

前端 未结 5 1263
猫巷女王i
猫巷女王i 2021-02-01 14:56

I found in one article saying \"static_cast is used for non-polymorphic type casting and dynamic_cast is used for polymorphic type casting\". I understand that int and double ar

5条回答
  •  悲&欢浪女
    2021-02-01 15:09

    Well, the answer is simple. A class having atleast one virtual function is called a polymorphic type. This can be only a destructor also.

    So the following is a 'polymorphic type'.

    struct Test {
      virtual ~Test();
    };
    

提交回复
热议问题