returning an abstract class from a function

后端 未结 7 787
甜味超标
甜味超标 2020-12-03 07:07

Is it possible to return an abstract class(class itself or a reference, doesn\'t matter) from a function?

7条回答
  •  無奈伤痛
    2020-12-03 07:19

    No, but a function could have a return type of a pointer (or a reference) to an abstract class. It would then return instances of a class that is derived from the abstract class.

提交回复
热议问题