Prachi K.

asked • 03/02/20

Write a class with constructors and destructors functions.

A point in a two-dimensional plane having coordinate as (x,y), can be represented by a class whose private data members are x and y. Write the constructor and destructor functions of the class. The constructor should initialise (x,y) by passing parameters values. Now, a rectangle can be represented by the top-left and bottom-right vertices. Define a class say ‘Rectangle’ whose private data members are top-left and bottom-right vertices. Write the parameterised constructor function of the class ‘Rectangle’. Also, write the destructor function. Finally, write a program to show the order in which different constructors and destructors are called.


1 Expert Answer

By:

Patrick B. answered • 03/03/20

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.