C++ Abstract Class: constructor yes or no?

后端 未结 8 1889
轮回少年
轮回少年 2020-12-04 08:45

A class with one (or more) virtual pure functions is abstract, and it can\'t be used to create a new object, so it doesn\'t have a constructor.

I\'m reading a book t

8条回答
  •  悲哀的现实
    2020-12-04 09:10

    To initialize firstName and lastName. Otherwise you will have to write a code to initilze them in each derived classes' constructors

提交回复
热议问题