What is the syntax of constructor in C++?

C++ allows us to use the three constructor functions we have discussed in the same class. For example: class complex { int a, b; public: complex() // default constructor { a= 10; b=45; }; complex( int x, int y) // parameterized constructor { a=x; b=y; }; complex( complex & v) // copy constructor { a=v.a; b=v.b; }; };

Sizin İçin Seçtik  Binance Güncelleme güvenilir mi?

Leave a Reply

Your email address will not be published. Required fields are marked *