Why is calling constructor from class above package allowed?
Show older comments
I just noticed that I can call a constructor from an instance of a class that is situated just above the package that the class is in. I haven't done too much testing to fully flush this out but here is a rough example setup which I believes mimics my case.
For example, in my limited testing the following works, assuming the given folder structure:
- /root/@class1
- /root/+class1/@class2
x = class1;
x.class2 %calls the constructor of class2.
Is this a bug or a feature? I would expect that this would be a call to a method or property of the instantiated object class1, which if not present, would throw an error.
Thanks, Jim
Accepted Answer
More Answers (0)
Categories
Find more on Software Development Tools 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!