octave-maintainers
[Top][All Lists]
Advanced

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

Re: default constructor and class


From: Patrick Noffke
Subject: Re: default constructor and class
Date: Mon, 8 Jul 2013 15:06:05 -0500

On Mon, Jul 8, 2013 at 2:59 PM, Marco Vassallo
<address@hidden> wrote:
>>
>> Is 'A' an existing class within Octave that you are using, or another
>> class you wrote?
>>
> A is a class from an external library. It  provides other constructors, but 
> which requires
> as arguments elements which would be in my derived class only for this 
> purpose.

I don't understand this statement.  Are you saying the elements are
needed by A's constructor, but somehow not actually used because of
how your B class uses A?  Or something else?

> If I add these extra element, the class works, but I was wondering if there 
> was a better way of doing it.
>

If you can come up with sensible defaults for A, and don't need to
expose them in B's constructor, then just add them as additional
member variables (declared before A in B's header file), and pass them
to A.

As Michael suggested, pointing us to a specific reference would help.

Patrick


reply via email to

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