C++ Program to display the cube of the number upto a given integer using Destructor

Write C++ Program to display the cube of the number upto a given integer using Destructor.

C++ Program to display the cube of the number upto a given integer

The destructor ~T4Tutorialst() is a member function of the class T4Tutorialst. Destructor  ~T4Tutorialst() has the same name as the name of its class T4Tutorialst. The tild sign ∼ is used before the name of the destructor ~T4Tutorials_Series().

  • When the object T4Tutorialst obj(p,q);of the class T4Tutorialst destroyed, then the destructor ~T4Tutorialst() also destroyed automatically.
  • One class T4Tutorialst can have only one destructor ~T4Tutorialst(). However, one class can have many constructors.
  • Destructor ~T4Tutorialst()overloading is impossible.
  • The Destructor ~T4Tutorialst()can’t have any arguments(parameters).
  • The destructor ~T4Tutorialst()has no data type.

Output

Please enter the number:

4

cube of 1 is: 1

cube of 2 is: 8

cube of 3 is: 27

cube of 4 is: 64

Add a Comment