Boost logo

Boost :

From: helmut.zeisel_at_[hidden]
Date: 2001-08-29 02:21:48


--- In boost_at_y..., Philipp K. Janert <janert_at_i...> wrote:
>

>
> Excuse my ignorance, but: What does the word
> "covariance" mean in OO or Computer Science?
>

I do not know an exact definition,
but one usage of the word is
in the discurssion of "virtual constructors":

class A
{
public:
  A* clone(); // returns clone of A
};

class B
{
public:
  B* clone(); // "covariant" result type instead of exact match
};

In former versions of C++, the result type of the
member of the derived class hat to match exactly,
now "covariant" result types are allowed.

If you look at the register of Stroustrup, 3e,
you will also find the word "contravariance"

Helmut


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk