c++, protected abstract virtual base pure virtual private destructor

前端 未结 5 1654
长情又很酷
长情又很酷 2020-12-25 13:32

So, I found this quote today, can anyone explain?

\"If you think C++ is not overly complicated, just what is a protected abstract virtual base pure virtual private d

5条回答
  •  隐瞒了意图╮
    2020-12-25 14:23

    Basically, he just threw together a bunch of words and stuck them together without realizing they actually refer to different things, or often, the same thing.

    protected abstract virtual base
    

    Pretty simple.

    class Base { // BASE
        virtual something() = 0; // ABSTRACT
    };
    class Derived : protected virtual Base { // PROTECTED VIRTUAL
    };
    

    pure virtual private destructor

    Also pretty simple.

    class Base { // BASE
    private:
        virtual ~Base() = 0; // pure virtual, private, destructor
    };
    class Derived : Base {
    };
    

    Of course, pure virtual is the same as abstract.

    It's quite clearly complete and total hyperbole written by someone who doesn't have a clue what he's talking about.

提交回复
热议问题