help-octave
[Top][All Lists]
Advanced

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

Re: OOP: getting caller name


From: Jaroslav Hajek
Subject: Re: OOP: getting caller name
Date: Wed, 1 Sep 2010 13:46:15 +0200

On Wed, Sep 1, 2010 at 12:52 PM, CdeMills <address@hidden> wrote:
>
> Hello,
>
> A new question about my dataframe class. I want it to mimic as much as
> possible a double matrix. So I would like that:
>
> df= dataframe(randn(10));
>
> x = df <= x is a copy of df, and thus a dataframe
>
> abs(df) <= abs expects a double matrix, so have df behave as if it was a
> matrix, i.e. the evaluation of df should return an object of class 'double
> matrix', and not dataframe.
>
> I tried:
> abs(df) => fails at it seems abs() receive directly a 'dataframe' object
> abs(df(:, :)) => succeed as it goes through overloaded subsref
>
> Any idea on how to achieve this ?
>
> Regards
>
> Pascal
>
>

There is no generic way; you have to create an overloaded method for
each function or use dispatch() at runtime.

-- 
RNDr. Jaroslav Hajek, PhD
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz


reply via email to

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