Answers for "Anonymous Object in C++"

C++
-1

Anonymous Object in C++

#include <iostream>
 
using namespace std;
 
class A {
    public: A() //   constructor  
    {
        cout << "Constructor executed" << endl;
    }~A() // Destructor   
    {
        cout << "Destructor executed" << endl;
    }
};
int main() {
    A(); // calling constructor
    A(); // calling constructor
}
Posted by: Guest on February-20-2021

Browse Popular Code Answers by Language