← Back to team overview

dolfin team mailing list archive

Re: question concerning Generic* operator=

 

2008/4/29 Kent-Andre Mardal <kent-and@xxxxxxxxx>:
>
> We have the following operator= in GenericVector
>
>    /// Assignment operator
>    virtual const GenericVector& operator= (const GenericVector& x) = 0;
>
> and a similar one in eg. EpetraVector:
>
>    /// Assignment operator
>    const EpetraVector& operator= (const EpetraVector& x);
>
> Is this operator an implementation of the operator in GenericVector ?
>
> Kent

No, because the signature is different. The signature of a function
includes the name, const status, and specific list of argument types.

For regular functions, the return type of an overloaded function can
be a pointer to a subclass of A if the superclass function returns A*,
and probably similarly with references.

However, I think you showed me this did not work with operator=, and
that was why you added the second operator signature. So if you have
all EpetraVector references, things will work out fine. Otherwise,
GenericVector references will be used.

--
Martin


Follow ups

References