class A { public: int getId() { return id; } void setId(int id) { id_ = id; } private: int id_; }; class B : public A { public: int getId() { return A::getId(); } void setId(int id) { A::setId(id); } } class C : public A { public: int getId() { return A::getId(); } void setId(int id) { A::setId(id); } };
First, see solution 1, it explains the issue pretty well.
In addition to that, the getId and setId functions (in your case) are implicitly inline, so you don't have to bother with reduction in performance in this case.
getId
setId
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)