Sum of the series Using Destructor in C++

Sum of the series Using Destructor in C++.

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

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

Program of Sum of the series in C++

Output

Please input the number of terms. 5

The sum of T4Tutorails_ Series is 111105.

Sum of the series Using Destructor in C++

Leave a Reply

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