![]() ![]() When an object is declared in a parameterized constructor, the initial values have to be passed as arguments to the constructor function. Okay, and he will give a new marker for you. And this is what a parameterized constructor is! Then the third one you go to a shop and say I want a marker like this(a physical marker on your hand). So in this case you have given the parameters. So you are mentioning this and he will give you that marker. ![]() And this is what a default constructor is! The second method you go to a shop and say I want a marker a red in color and XYZ brand. So when we said just I want a marker so whatever the frequently sold marker is there in the market or in his shop he will simply hand over that. So just saying give me a marker mean that you did not set which brand name and which color, you didn’t mention anything just say you want a marker. When you want to buy a marker, what are the options? The first one you go to a shop and say give me a marker. Suppose you went to a shop to buy a marker. Let us understand the types of constructors in C++ by taking a real-world example.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |