Yes, there are a way to call a constructor late. The method is used when
creating an object in an already existing memory buffer.
However, note that a constructor normally affects all fields - and
allocates resources - so you do not want to run the constructor multiple
times.
If you want to reset the object to an initial value, you should instead
create a method init() - or possibly clear() - and have the constructor
call this method.
Once more, you do not want to call a constructor multiple times! If the
constructor allocates memory, you would get memory leaks.
/Per W
On Sun, 28 May 2006, Erik Schmidt wrote:
> is there a way to call a constructor on a class after the object has
> been created?
>
> simply put, I wish to create an object, perform operations on it,
> then modify it using it's constructor
>
> is this possible?
>
>
> -------------------------------------------------------
> All the advantages of Linux Managed Hosting--Without the Cost and Risk!
> Fully trained technicians. The highest number of Red Hat certifications in
> the hosting industry. Fanatical Support. Click to learn more
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|