28 Ott 2002
Costruzione di Interfacce - Paolo Cignoni
39
•[Bar.H]
#include "Foo.H" // must include Foo.H since
                 // we declare an instance of it

class Bar {
public:
    Bar(int a, int b);
protected:
    Foo m_foo; // declare an instance of Foo
};

[Bar.C]
Bar::Bar(int a, int b) : m_foo(a,b) // call Foo::Foo(int,int)
                                    // and initialize m_foo
{
    Foo fooLocal; // create another instance of Foo, this time
                  // as a local var

    // do something with the two Foos, m_foo and fooLocal
}