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;
}
This entry was posted in Programming and tagged , , , , . Bookmark the permalink.

2 Responses to Will the destructor be called?

  1. RyanA says:

    Killin me, I don’t even see the assignment ;;

    btw, nice theme update :)

  2. astrobunny says:

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

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>