destructor, assignment op, and copy constr in Date

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

destructor, assignment op, and copy constr in Date

Gilbert Peffer
Personally I prefer to always define the operator= and the copy constructor,
independently of the class containing dynamic memory allocation. Also I
wouldn't mind seeing the destructor in every class, although it doesn't do
anything in this particular case. It's just that I got used to these things
when deriving long class trees from ABCs.
Gilbert



Reply | Threaded
Open this post in threaded view
|

Re: destructor, assignment op, and copy constr in Date

Luigi Ballabio-3
At 12:56 PM 12/21/00 +0100, Gilbert Peffer wrote:
>Personally I prefer to always define the operator= and the copy constructor,
>independently of the class containing dynamic memory allocation.

Ouch. We might be talking of a major pain in the neck here... Also, one has
to keep track of these things. To add a data member and forget to add it to
the operator= and the copy constructor is a tad too easy for my likings.

Just my thoughts,
                         Luigi



Reply | Threaded
Open this post in threaded view
|

RE: destructor, assignment op, and copy constr in Date

Gilbert Peffer
> >Personally I prefer to always define the operator= and the copy
> constructor,
> >independently of the class containing dynamic memory allocation.
>
> Ouch. We might be talking of a major pain in the neck here...
> Also, one has
> to keep track of these things. To add a data member and forget to
> add it to
> the operator= and the copy constructor is a tad too easy for my likings.
>
That's OK with me if everybody is happy about it. It was just that if you
got a pointer data member in there, you will have to define them anyway. And
most of the time you got ...

Gilbert





Reply | Threaded
Open this post in threaded view
|

RE: destructor, assignment op, and copy constr in Date

Luigi Ballabio-3
Hi there,

At 02:09 PM 12/21/00 +0100, Gilbert Peffer wrote:

> > >Personally I prefer to always define the operator= and the copy
> > constructor,
> > >independently of the class containing dynamic memory allocation.
> >
> > Ouch. We might be talking of a major pain in the neck here...
> > Also, one has
> > to keep track of these things. To add a data member and forget to
> > add it to
> > the operator= and the copy constructor is a tad too easy for my likings.
> >
>That's OK with me if everybody is happy about it. It was just that if you
>got a pointer data member in there, you will have to define them anyway. And
>most of the time you got ...

Actually, most of the times we wrap a pointer to a single object into
Handle (which can manage being copied around) and arrays of objects into
std::vector (ditto).
I don't remember having many pointer data members around...

Bye,
         Luigi