What should you do?

Suppose that you are writing code for a class named Product. You need to make sure that the data members of the class are initialized to their correct values as soon as you create an object of the Product class. The initialization code should always be executed. What should you do?
A. Create a static method in the Product class to initialize data members.
B. Create a constructor in the Product class to initialize data members.
C. Create a static property in the Product class to initialize data members.
D. Create an event in the Product class to initialize data members.

microsoft-exams

Leave a Reply

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


The reCAPTCHA verification period has expired. Please reload the page.