Parameterised Constructor in C++
We know that whenever we create a class, a default constructor gets created, which is invisible mainly in other languages. But when we make a constructor by ourselves, there is flexibility for us to pass the arguments we might think are necessary for the constructor while creating the object in the primary function. Creating a parametrised constructor is pretty simple. We must make our constructor in the class function pass the necessary parameters.
/ tm p/ po Rl 42 Ph db .o the value we have created for p1.b is: 10, the value we have created for p1.b is: p1.c = 15
/tmp/poRl42Phdb.o the values for t1.x is: 20 the values for t2.x is: 15 After destructing the objects which have the value of x is as follows: 15 After destructing the objects which have the value of x is as follows: 20
after calculating the area of rectangle 1, we have got as 15624 after estimating the size of rectangle two, we have obtained: 28911
JavaTpoint offers too many high quality services. Mail us on h[email protected], to get more information about given services.
JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected].
Duration: 1 week to 2 week