<<<Index>>>

Destructor Calls


  • ~Point() is the destructor for
    class Point.
  • You don't call destructors yourself !
  • Destructors do not:
    • take args (so they cannot be overloaded);
    • they do not return anything.
// point.h
class Point
{
    public:
        ~Point(); // destructor
    private:
        int m_x;
        int m_y;
};
// point.cpp
#include <iostream>
#include "point.h"
Point::~Point()
{
    std::cout << "Goodbye...";
}
// main.cpp
#include "point.h"
void main()
{
    Point pt;
}// ~Point() destructor is invoked here
<<<Index>>>