octave-maintainers
[Top][All Lists]
Advanced

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

Re: OOP load update


From: John W. Eaton
Subject: Re: OOP load update
Date: Tue, 5 May 2009 19:18:27 -0400

On  5-May-2009, Robert T. Short wrote:

| MATLAB actually can reconstruct all of the 
| fields of the underlying struct from the mat file, but it is not able to 
| reconstruct inheritance from the mat file.  Calling the constructor 
| seems like a natural way to do it, but MATLAB doesn't seem to ever call 
| the constructor when loading from a mat file. 

Are you sure about that?  Try creating and saving an object of a class
then make the constructor for that class unavailable in smoe way
(rename the @NAME directory that contains the constructor, for
example).  Then restart Matlab and try loading the file.  Does it
complain about not being able to find the constructor?  Or that it
can't create the class, so it is converting it to a structure instead?

| In order to load a class with parent classes, you first need to 
| instantiate an object from the class constructor and then load the mat 
| file.  This is now the way things work in octave, but I have been 
| thinking about invoking the class constructor to fill in the class 
| structure.  As long as the constructor doesn't require arguments it 
| should work, but I haven't really thought it out that far yet.

It should not be necessary to call the constructor unless an object of
the class has not yet been created at the point where you need to
know something about the class layout.

jwe


reply via email to

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