OONumerics User :

From: Markus Blatt (mblatt_at_[hidden])
Date: 2005-12-05 04:36:59


On Thu, Oct 13, 2005 at 11:05:12AM +0200, Pascal Bauer wrote:
> Hi,
>
> I have the following Question:
>
> Is it possible to use the Barton-Nackman Trick, when by base-cass have no
> default constructor?
>
> In my code, the derived class has no default constructor. How can i pass the
> argument from my derived class to the base class?
>

Like in any C++-class by explicitly calling the constructor of the base
class:

template<class Child>
class Base{
        Base (int i);
};

class Child : public Base<Child>
{
public:
  Child(int i)
    : Base<Child>(i)
  {}
};

Cheers,

Markus

--