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 16:15:55 -0400

On Mon, Jul 8, 2013 at 4:07 PM, Marco Vassallo <address@hidden> wrote:
>
>
> To be honest, it's hard to help without more concrete information. But
> if class A does not provide a public/protected constructor, maybe it
> provides another constructor that accepts argument. If it does not,
> then it means class A was not intended to be used directly and you're
> misusing it.
>
Class A provides other constructors, but as the default constructor is needed only for the
Octave functions

DEFINE_OCTAVE_ALLOCATOR (myclass);
DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (myclass, "myclass", "myclass");

I was looking for a solution which avoid to call this functions but still allows me to register
myclass in the octave interpreter.

Here is the header file [1]
and here [2] is how I implemented the class right now.

[1] http://fenicsproject.org/documentation/dolfin/1.2.0/cpp/programmers-reference/function/FunctionSpace.html#FunctionSpace
[2] http://sourceforge.net/p/octave/fem-fenics/ci/default/tree/src/functionspace.h


Thanks for the pointer. As FunctionSpace does not provide a default constructor, you're not supposed to use like that. So either you provide sensible default values to the constructor of FunctionSpace, or you use a pointer to a FunctionSpace object, so you can construct it only when required (at which point I suppose you'll have the required arguments to provide to the FunctionSpace constructor).

Michael.


reply via email to

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