octave-maintainers
[Top][All Lists]
Advanced

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

Re: OOP and load/save


From: Judd Storrs
Subject: Re: OOP and load/save
Date: Thu, 23 Apr 2009 12:34:29 -0400

On Thu, Apr 23, 2009 at 12:10 PM, John W. Eaton <address@hidden> wrote:
On 23-Apr-2009, Judd Storrs wrote:

| ??? Error using ==> class
| Number of fields for class Foo cannot be changed without clear classes.

What if you just change the name of a field, but leave the number of
fields the same?  Does that also generate an error (I hope the answer
is yes).

Yes,

??? Error using ==> class
Field names and parent classes for class Foo cannot be changed without clear classes.

Details:

Starting with @Foo/Foo.m:
function f = Foo()
  f.dataelement = 'I am Foo';
  f = class(f,'Foo');

>> bar = Foo() ;
>> struct(bar)
ans = dataelement: 'I am Foo'

Outside Matlab change @Foo/Foo.m:
function f = Foo()
  f.newelement = 'I am a different Foo';
  f = class(f,'Foo');

>> bar = Foo() ;
??? Error using ==> class
Field names and parent classes for class Foo cannot be changed without clear classes.

Error in ==> Foo.Foo at 3
  f = class(f,'Foo');


--judd


reply via email to

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