The problem is: ExampleIt
which inherits (and overrides methods) from class It
, so that when I overload operator in class Wrapped
(which calls some methods from It
, which should be overridden by ExampleIt
.
The wanted effect is that when I overload operator*
I should be able to call *name_of_Wrapped_class
and this should execute virtual method Dereference
(from It
) which should be overridden by ExampleIt
.
class It {
public:
virtual std::pair<int, std::string> Dereference() const;
};
class ExampleIt : It {
public:
std::pair<int, std::string> Dereference() const override;
};
class Wrapped : It{ //??? not sure about that
public:
std::pair<int, std::string> operator*() const; // it should call for Dereference()
};
Aucun commentaire:
Enregistrer un commentaire