What is the difference between Casse obj; and Class* obj = new Class(); in C++?

Asked

Viewed 27 times

0

I know that using Class obj; I’m storing obj in Stack and with Class* obj = new Class(); I’m storing in Heap. But in practice, what’s the difference?

  • http://answall.com/q/57006/101 helps as well. In practice the difference is already in the question, this is not theory.

  • But what’s the practical difference in allocating to Stack or Heap? When I want to allocate to the heap, if I can pass the address of the one in the stack and change by reference?

  • If you follow all the links that has in the questions and in the answer there will see all this. It is all answered already. see also: http://answall.com/q/83293/101, http://answall.com/q/56580/101 and http://answall.com/q/120103/101

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.