Abstract Method Signature Definition

Hello,
I want an abstract class in which an abstract method called "RunModel" is defined. Nevertheless, this " RunModel " does receive different parameters depending on the child class. For Example
  • classX_instance.RunModel()
  • classY_instance.RunModel(param1, param2)
  • classZ_instance.RunModel(param1)
What is the best way to define the abstract method in the abstract class? I have noticed that if I simply define it as:
methods(Abstract=true, Access=public)
RunModel(this);
end
it actually works, but I have an uneasy feeling about it. Is there a better way to do it?
Thanks

답변 (1개)

Anand Swaroop
Anand Swaroop 2021년 12월 7일

0 개 추천

your definition of abstract method is absolutly correct. by default access property of a mathod is public. So you can omit it to reduce signature. you can write your mentioned example as following
method(Abstract)
RunModel(this);
end
this might suit well to your expectation.
for more information you can read following documentation
Thanks
Anand Swaroop

카테고리

도움말 센터File Exchange에서 Class Introspection and Metadata에 대해 자세히 알아보기

제품

질문:

2013년 10월 18일

답변:

2021년 12월 7일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by