Skip to content

Latest commit

 

History

History
40 lines (33 loc) · 688 Bytes

destructor.md

File metadata and controls

40 lines (33 loc) · 688 Bytes
description Learn how to Handle with Desctructors
title Destructor Handling
ms.date 19/11/2023
ms.topic conceptual
author fejo-git
ms.reviewer ---

Destructor

definition

  • Constructor: Upon creating the class
  • Destructor: At the end

code-example

class Auto {
private:
int *a;
public:
Auto() {
    a = new int[10];
    std::cout << "Konstruktor!" << std::endl;
}
~Auto() {
    delete [] a;
    std::cout << "Destruktor!" << std::endl;
}
};

See also