anonymous object in c++ example
Example: 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
}