C++ Abstract Class: constructor yes or no?

后端 未结 8 1896
轮回少年
轮回少年 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 08:57

    The Employee class has data and this data needs to be initialized somehow. Constructor is a good way to do that.

提交回复
热议问题