octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: default constructor and class


From: Michael Goffioul
Subject: Re: default constructor and class
Date: Mon, 8 Jul 2013 15:27:45 -0400

On Mon, Jul 8, 2013 at 3:20 PM, Marco Vassallo <address@hidden> wrote:
Hi all,

for the fem-fenics pkg I'm creating a new class, and I thus add as private members

  DECLARE_OCTAVE_ALLOCATOR;
  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA;

and also the DEFINE counterpart,

which requires the class to have a default constructor (right?)

The problem is that one of the parent class from which I derive my own class
doesn't provide a default constructor. Example

class B: public octave_base_value, public A
{
  B(): octave_base_value(), A(), B() {} //error: A() not available

  private:
  A my_element;
  DECLARE_OCTAVE_ALLOCATOR;
  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA;
}

How can I manage it?

I'm not sure I understand your construct correctly, but is it intentional that B inherits from A *and* contains a A object (my_element)? Can't you get rid of the inheritance from A and just have the my_element member?

Michael.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]