jeudi 23 avril 2015

Pure virtual interface and move semantic

According to “Rule Of Five” when I declare one of: copy or move operation or destructor I must write all of them, because compiler doesn't generate them (some of them) for me. But if my class (A) inherit after pure virtual interface with virtual destructor, does this destructor in class A will be visible as user-defined? As a consequence move semantic will not work with objects of this class A (because compiler doesn't generate move constructor for me)?

struct Interface {
    virtual myFunction() = 0;
    virtual ~Interface() {};
};

struct A : public Interface {
    void myFunction() override {};
}

Aucun commentaire:

Enregistrer un commentaire