What is the benefits of copy constructor in C++?

Class A is flexible and safe : you create a copy from any A object you have, even if it’s a temporary one. Class B is less safe as you could invoke the constructor with a nullptr . It’s less flexible because you can only use ypur constructor to copy an object from which you can get the address and which is not const.3 Eyl 2015

Sizin İçin Seçtik  Why constructor is needed for a class in C++?

Leave a Reply

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