I have class called Bar, and in this class Bar there is an object of type Foo (a class). Class Bar takes 3 parameters, x, y and z. Foo takes 2 parameters, y and z.
currently I'm doing this:
class Bar { public: Bar(int x, int y, int z) { foo = new Foo(y, z); do something with x; } private: Foo * foo; }; I remember seeing in a book another way to do this using a colon but I don't remember how exactly.
What is the standard or usual way of doing something like this?