/// pidgin C++
##INHERITANCE when it's possible to broke invariant##
class A{
int foobar; ..
public:
foo () { bar().. }
bar () {..} // DOES has some contract..
};
class B : A {
public:
bar () { /* let's broke foo() - let's implement someth cruel here */ } // BROEKN bar's contract
}
... <some client code may be B's method> ...
B->foo () // THIS CALL can't guarantee A+B's INVARIANT [ A's one to be presice ]
...
================
##DELEGATION+COMPOSITION##
class B {
A* a;
public:
...
a->foo (); // IS *SAFE* NOW <--
...
}