Posts

Showing posts from September, 2011

copy constructor

class Cents { private:     int m_nCents; public:     Cents(int nCents=0)     {         m_nCents = nCents;     }     // Copy constructor     Cents(const Cents &cSource)     {         m_nCents = cSource.m_nCents;     } }; In above c++ code  why parameter cSource (const Cents &cSource) is passed as reference?