If I have a class named Object, what's the difference between creating an instance just like that:
#include
Object var;
main ()
{
var.test();
}
or
#include
main ()
{
Object* var = new Object();
var->test();
}
Which is the differente between a global object (which you can use wherever you want) and create a dynamic object in the main.cpp? In theory it should be the same, right? The both method can be used in any file.cpp.
No comments:
Post a Comment