While using class method to create an object: "Base object for class 'Test_class' constructor is invalid".
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Farhan Masood
am 29 Nov. 2016
Beantwortet: Steven Lord
am 29 Nov. 2016
I am trying to create a class using state space ss class as parent class and a struct P1 as follows:
P1.n=0;
P1.p=0;
P1.q=0;
P1.l=0;
P1.m=0;
P1=class(P1,'Test_class',ss);
My guess is there is a problem with size matching but i cannot figure it out.
0 Kommentare
Akzeptierte Antwort
Steven Lord
am 29 Nov. 2016
You cannot define a class using the older class syntax (where you call the class function inside the class's constructor function) that subclasses a class defined using the newer class syntax (one defined using a classdef file.)
From the documentation: "It is not possible to create class hierarchies that mix classes defined before Version 7.6 and current class definitions that use classdef. Therefore, you cannot subclass an old class to create a version of the new class."
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Handle Classes finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!