MATLAB: Saving all Superclass properties inside one subclass property

classesinheritanceMATLABobjectooppropertiessubclasssuperclass

Feature class created with proerties featid & to_delete
classdef Feature < handle
properties (Access = public)
% Unique ID of this feature
featid;
% If this feature should be deleted
to_delete;
end
methods
function obj = Feature()
end
function obj=clean_old_measurements(obj,valid_times)
end
end
end
Sub class FeatureDatabase inherites from Feature class
classdef FeatureDatabase < Feature
properties (Access = public)
% Mtx for our map
mtx;
% Our lookup array that allow use to query based on ID
features_idlookup;
end
methods
function obj = FeatureDatabase()
% Default constructor
obj.features_idlookup = Feature;
end
function obj=cleanup_measurements(obj,timestamp)
end
end
end
The object F is created which uses the methods from Feature class. Below code shows that not only we inherite from Feature class, as well as the all the properties of the Feature class are stored in the features_idlookup.
>> F = FeatureDatabase()
F =
FeatureDatabase with properties:
mtx: []
features_idlookup: [1×1 Feature]
featid: []
to_delete: []
How can I inherite from the superclass and store all the properties only in features_idlookup?
I want to achieve the following. Suggestions and help is appericiated. Thank you in advance.
>> F = FeatureDatabase()
F =
FeatureDatabase with properties:
mtx: []
features_idlookup: [1×1 Feature]

Best Answer

Should FeatureDatabase inherit from Feature (be a Feature?)
Or should FeatureDatabase have a property that contains an array of Feature objects? In this case, FeatureDatabase should not be a subclass of Feature.