help-octave
[Top][All Lists]
Advanced

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

Re: function overloading without dispatch of a class defined in C++


From: c.
Subject: Re: function overloading without dispatch of a class defined in C++
Date: Fri, 6 Jan 2012 11:45:16 +0100

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

HTH,
c.




reply via email to

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