InheritanceTrail Index | Objects 2 | Inheritance Objects can inherit data and function members from other objects. incomplete class Point { protected: double x,y; }; class DataPoint: public Point { protected: double e; }; int main() {}; class Function { public: double operator() (const double x); }; class Function1 : public Function { public: double operator() (const double x) { return x; } }; class Function2 : public Function { public: double operator() (const double x) { return x*x; } }; double callFunction(Function& F, double x) { return F(x); } int main() { } < Object Encapsulation | Trail Index | More > |