|
-
February 25th, 2003, 09:35 AM
#1
Consitutive class woes
Hi there I am trying to construct a composite class of a number of componets called Model.
One of the componets is an abstract class called Equations. An example of one of its member classes (Lorenz) copy member function is:
Equations* Lorenz::copy() const
{
return (new Lorenz(*this));
}
The simplified constructor for class Model is:
Model::Model(const Equations & equat)
:myEquation(equat.copy())
{
}
In main I make an Equations object and then an Model object i.e.
Lorenz button();
Model jelly(button);
Now the problem I have is that if I manipulate the data members of Equations from main, the Equations object in the Model object is not changed.
I checked the memory of the two Equations objects and they are different. Is there anyway to pass the actual object without changing its memory address?
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|