[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: function overloading without dispatch of a class defined in C++
From: |
Alexander Barth |
Subject: |
Re: function overloading without dispatch of a class defined in C++ |
Date: |
Fri, 6 Jan 2012 13:26:54 +0100 |
On Fri, Jan 6, 2012 at 11:45 AM, c. <address@hidden> wrote:
>
> On 6 Jan 2012, at 11:24, Alexander Barth wrote:
>
>> Dear all,
>>
>> I would like to overload a function (e.g. close) for a custom object
>> defined in C++ (e.g. octave_ncfile defined in the package octcdf).
>> Currently I used dispatch to do this. I created a C++ function ncclose
>> and I used "dispatch('close','ncclose','ncfile');". So that
>>
>> close(instance_of_octave_ncfile)
>>
>> would call
>>
>> ncclose(instance_of_octave_ncfile)
>>
>> However dispatch is now obsolete, but I do not know how I can add a
>> method to the C++ definition of octave_ncfile which is visible from a
>> script.
>>
>> Any help would be greatly appreciated.
>>
>> Best regards,
>> Alex
>
> I think this can be done by creating a file named close.m in a directory
> named @ncflie
> and put the following in @ncfile/close.m:
>
> function close (file)
> ncclose (file)
> endfunction
>
> but I am not able to check at the moment
Excellent! This works! I didn't know that your can simply mix the
definition of classes defined in C++ with scripts.
Cheers,
Alex
>
> HTH,
> c.
>
>
- Prev by Date:
Re: Parallel Computing MATLAB vs Octave
- Next by Date:
Re: set(h,'color',[1,0,0 ; 0,1,0 ; 0,0,0]) or set(h,'color',mat2cell(rainbow(3))) ??
- Previous by thread:
Re: function overloading without dispatch of a class defined in C++
- Next by thread:
Re: error when making a checkout of octave: gnulib not found
- Index(es):