assign class object to array
Ältere Kommentare anzeigen
Assume the following class
classdef A < handle
methods
function obj = A
disp('constructor called')
end
end
end
Now create an array of 10 instances of A
>> a(10) = A
constructor called
constructor called
Why is the constructor called twice? Why not 10x or 1x?
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Construct and Work with Object Arrays finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!