Inherit from const class

后端 未结 8 1686
不思量自难忘°
不思量自难忘° 2021-01-12 00:24

I would like to inherit from a class with the const specifier like this:

class Property
{
    int get() const;
    void set(int a);
};

class Co         


        
8条回答
  •  长发绾君心
    2021-01-12 00:43

    I would like to inherit from a class with the const specifier"

    However much you want to is irrelevant. You cannot. That is not valid C++.

    Can I somehow use the const keyword for inheritance?"

    No.

提交回复
热议问题