What is the role of a constructor in classes? Explanation: A constructor is used in classes to initialize data members of class in order to avoid errors/segmentation faults .
What is the role of a constructor in classes? Explanation: A constructor is used in classes to initialize data members of class in order to avoid errors/segmentation faults .