[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Did I miss something about structures and function handles
From: |
kensmith |
Subject: |
Re: Did I miss something about structures and function handles |
Date: |
Sat, 18 Aug 2007 13:03:06 -0700 |
User-agent: |
KMail/1.9.1 |
I'm going to insert some more stuff within my text to try to make it
clearer since as M. Mrennwald pointed out I didn't make this point
clearly.
On Saturday 18 August 2007 12:36, Matthias Brennwald wrote:
> On 18.08.2007, at 19:04, address@hidden wrote:
> > I can say:
> >
> > b.a=@(X)(disp(X-3))
b.X=52
b.Y=27
> >
> > if I then say
> >
> > c = b
c.X=23
c.Y=45
> > c.a(7)
> >
> > I get 4 as expected.
> >
> > This looks to me like 90% of object oriented programming is in
> > octave. Is there some way that I can get at the other elements of
> > "b" and "c" from the member "a".
>
> Which 'other elements' of b and c do you mean? In your example above,
> I can see only one element (a) in b and c.
Lets use the example that the "b" and "c" variables represent different
points in space. Lets further add a variable "d" that is a circle.
d=b; # Make it a point first
d.R=3; # Now give it a radius also.
Now lets imagine that the "a" function for a circle needs to be
different:
d.a = @(X)(disp(2+X));
We have now created a child type to the parent.
If we say:
MyNewVariable = b;
MyNewVariable..a(4);
or:
MyNewVariable=d;
MyNewVariable.a(4);
We will get the different answers as we should. I want to be able to
get at the X and Y and perhaps the R of the variable in question in the
function "a".
I think I've made the idea clearer. Did I?
>
> Matthias
>
>
> -------
> Matthias Brennwald
> Lägernstrasse 6
> CH 8037 Zürich
> +41 (0)44 364 17 03
> address@hidden
--
address@hidden
- Did I miss something about structures and function handles, kensmith, 2007/08/18
- Re: Did I miss something about structures and function handles, Matthias Brennwald, 2007/08/18
- Re: Did I miss something about structures and function handles,
kensmith <=
- Re: Did I miss something about structures and function handles, James Sherman Jr., 2007/08/18
- Re: Did I miss something about structures and function handles, kensmith, 2007/08/18
- Re: Did I miss something about structures and function handles, Jordi Gutiérrez Hermoso, 2007/08/18
- Re: Did I miss something about structures and function handles, kensmith, 2007/08/18
- Re: Did I miss something about structures and function handles, Jordi Gutiérrez Hermoso, 2007/08/19
- Re: Did I miss something about structures and function handles, kensmith, 2007/08/19