Question

Q2: Given the class definition:
class CreateDestroy
{
public:
CreateDestroy() { cout << "constructor called, "; }
~CreateDestroy() { cout << "destructor called, "; }
};
What will the following program output?
int main()
{
for ( int i = 1; i <= 2; ++i )
CreateDestroy cd;
return 0;
}
a. constructor called, destructor called, constructor called, destructor called,
b. constructor called, constructor called,
c. constructor called, constructor called, destructor called, destructor called,
d. Nothing.

Answer

This answer is hidden. It contains 72 characters.