Recent Changes - Search:

Coding C++

Computing

Inheritance

Trail 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 >

Edit - History - Print - Recent Changes - Search
Page last modified on April 11, 2007, at 02:42 am