octave-maintainers
[Top][All Lists]
Advanced

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

default constructor and class


From: Marco Vassallo
Subject: default constructor and class
Date: Mon, 8 Jul 2013 21:20:50 +0200

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?
At the moment I'm adding some private members to the class, which I
use only for the default constructor

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

  private:
  A my_element;
  int aa;
  DECLARE_OCTAVE_ALLOCATOR;
  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA;
}

but it is not very nice, and I'm adding superfluous private members..any idea?

Thanks

Marco

reply via email to

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