if I have the following -
#include <iostream>
class object{
private:
public:
object();
object(some_item);
};
object a;
int main()
{
// why doesn't it let me do
a = new object(some_item);
// but lets me do
a = *new object(some_item);
}
I am trying to initialize a global object which will be initialized at runtime inside the main loop but not in the part where I defined it globally.
basically I want an object that is available globally and that can be initialized at runtime inside any function.
But I don't completely understand how the new/*new operator works.