Constructor must preserve the class of the returned object
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I've created a object, saved it to a file and loaded the object from the file and I get this error:
Warning: Error loading an object of class 'Param.clsParameter': When constructing an instance of class 'Param.clsParameter', the constructor must preserve the class of the returned object.
I do not have the construct on load switch set and I'm subclassing hgsetget. How is the constructor even involved on load? What I gather from: http://www.mathworks.com/help/techdoc/matlab_oop/bres1y6.html#br0li_j
is that is shouldn't be ?
From the page:
When loading objects from MAT-files the load function:
Creates a new object.
Calls the class constructor with no arguments only if the class's ConstructOnLoad attribute is set to true.
Assigns the saved values to the object's properties. These assignments results in calls to property set methods defined by the class.
How can the load process create a new object without calling the constructor?
Very difficult to debug this error.
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Construct and Work with Object Arrays dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!