Class folders and passing variables to objects
Show older comments
Hi all,
i am a beginner with classes and want to create a complex class structure.
My target is to generate a library for testing (TLib) with classes. Every Test needs a unique TestSet with Library Items (e.g. Criterion, Disturbance etc.) . A test specification defines a Unique TestSet. The TLib Object shall hold the TestSet and the collected initialization Parameter.
classdef TLib
properties (GetAccess = public , SetAccess = protected)
TestSet
InitParams
end
function obj = TLib(obj, TestSpecification)
obj.TestSet = FillTestSetProperty(TestSpecification);
end
end
When calling "TLib" the test specification shall be passed as an argument to fill the TestSet. My first Problem is, that the test specification is not passed as an argument.
TLib(TestSpecification)
What am i doing wrong? I also would like to treat TestSet and InitParams as inherited classes of TLib. InitParams shall hold all default initialization parameter as properties. These properties shall only be changed inside the TLib classes and subclasses. I would like to pass all initialization parameter from library items to the InitParams subclass.
My folder structure looks like this:
./+TLib/+criterion/default_criterion.m % <-Superclass with properties
./+TLib/+criterion/criterion1.m % <-subclass with a method to load properties of default Criterion
./+TLib/+criterion/criterion2.m %
./@TLib/TLib
% Path for InitParamsClass missing
% Path for TestSetClass missing
This works for me. The advantage is that I can see all variables by using namespace like this:
TLib.Criterion.criterion1
My main issue is, that I don't know how to pass arguments to the objects of TLib subclass InitParams and TestSet. So i need a folder structure and a minimal code example for implementing. I also did not menage to pass TestSpecifcation as an argument to TLib. Any links or hints are helpful.
Thank you!
Accepted Answer
More Answers (0)
Categories
Find more on Enumerations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!