Why does a class have only one destructor?

I was asked a question because the class has multiple constructors, but why does it only have one destructor?

I gave an example below,

class abc
{
public:
    int a;
    abc()
    {
        cout << "Default\n";
    }
    abc(int)
    {
        cout << "Int\n";
    }
    ~abc()
    {
        cout << "Destructor\n";
    }
};
int main()
{
    abc ab;
    abc a(5);
}

And I explained, as before, abc a (5); The destructor that gets the name will be called so there will be only one object at a certain point in time. I ran the code above on my PC, but it gave me the result as

Default
Int
Destructor
Destructor

If so, then why do we have one destructor?

+3
source share
6 answers

, . , , Destructors. , , . , . .

, , , , 1 Apple 1 Guava, 1 , .;)

. , .

abc a (5); ,

, , .

: -

, ( ), . , . ++.

+7

, ( ). - , . .

, delete delete[], . ? , .

+1

, , , . . , , , .

+1

, , . .

, , - .

0

. . const, volatile, const volatile static. , .

0

, .

when an object is created, its suitable constructor is automatically called to initialize the object. when a program is deleted from memory, a destructor for each object is called to delete these objects without reference from the pool of objects. since a destructor is a system procedure for clearing a pool of objects.

0
source