I've been recently creating a C++ based project of which I've been using Java style
//in class declaration
MyClass * c;
c = new MyClass();
b = new MyBClass();
style declarations. My question is, is this the regular way to create objects for class objects, or should I not use the "new" style (Java-like) method of instantiating classes within classes.
The biggest issue that comes up is that I want to be able to make *copies* of the values that these pointers point to, to be able to pass to other classes.
Lets say, I would do something like this:
Foo * myfoo = new Foo();
Foo * myfoo2 = myfoo; //which doesn't work, because I want to be able to modify myfoo2 without modifying myfoo :(.
Is this a pointer copy constructor issue? If so, how should I go about it? Is there some easy way to copy all values from within a class pointer into another class pointer?
Very much thanks in advance!