<<< | Index | >>> |
// point.h
class Graph { /*...*/ };
class Point {
private:
Graph& m_g;
int m_x;
int m_y;
public:
Point( Graph& g, int x, int y );
};
// point.cpp
Point::Point( Graph& g, int x, int y )
: m_g( g ),
m_x( x ),
m_y( m_x ) // UH-OH... m_x could still be garbage,
{} // so m_y might get it, too!
// main.cpp
void main()
{
Graph gr;
Point pt( gr, 10, 20 );
}
Nice demo of
<<< | Index | >>> |