help-octave
[Top][All Lists]
Advanced

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

Re: Calling a method of an object?


From: Juan Pablo Carbajal
Subject: Re: Calling a method of an object?
Date: Thu, 18 Oct 2012 22:38:33 +0200

On Thu, Oct 18, 2012 at 10:10 PM, Jordi GutiƩrrez Hermoso
<address@hidden> wrote:
> On 18 October 2012 16:08, Joanna Rutkowska <address@hidden> wrote:
>> And what happens if there is also a global function with the same name? Or
>> another method (of a different class) with the same name?
>
> Something like this, probably:
>
> http://abandonmatlab.wordpress.com/2010/05/30/the-mathworks-doesnt-even-know-how-to-look-up-functions-in-their-own-global-namespace/
>
> - Jordi G. H.
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://mailman.cae.wisc.edu/listinfo/help-octave

As they said, you have to call the method with the first argument
being the class. So
p = power (m1,...)

However there is a expensive work around if you really want the
object.method interface. Check the examples here
https://sourceforge.net/p/octave/code/11308/tree/trunk/octave-forge/main/geometry/inst/io/%40svg/

in particular check the subsref.m method

Disclaimer: This is a hack! It works but is hardly worth the effort.
Wait for classdef :D


reply via email to

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