Question 1#
What is the output of the following program?
True |
|
|---|---|
Answer A |
|
Answer B |
Answer A
begin main Foo() end main ~Foo()
Answer B
begin main Foo() ~Foo() end main
#include <iostream>
class Foo
{
public:
Foo() {
std::cout << "Foo()" << std::endl;
}
~Foo() {
std::cout << "~Foo()" << std::endl;
}
};
int main()
{
std::cout << "begin main" << std::endl;
Foo f;
std::cout << "end main" << std::endl;
return 0;
}