Archives for 10 August 2010 (1)
August 10, 2010

Will the destructor be called?

Here’s a C++ quiz for all of you: somefunc() will be called from a thread. Do you think this destructor will be called?

class A {
public:
	A () {
		printf("Constructor\t");
	}

	~A() {
		printf("Destructor\n");
	}
};

int somefunc () {
	A inst;
	int* a = 0
	*a = 1;
	return 0;
}
last comments  
astrobunny
astrobunny

Thanks. Well, assignment isn't neccessary the default constructor will be called upon instantiation
RyanA
RyanA

Killin me, I don't even see the assignment ;; btw, nice theme update :)
page 1 of 1