Force super class to not call overloaded methods of the subclass
조회 수: 6 (최근 30일)
이전 댓글 표시
I have a base class and subclass inheriting from it. Base class has method A. Subclass overloads that method. I want to force the base class to use (only in some places) it's own method, not the one overloaded by subclass. Is there any way to do it?
Thank you
댓글 수: 0
답변 (1개)
Shraddha Jain
2021년 6월 22일
Hi Naum,
When you create an object obj of a superclass and then use obj to call the overloaded (or any) method of the superclass, the method defined in the superclass is called and not the one of the subclass.
참고 항목
카테고리
Help Center 및 File Exchange에서 Battery Pack Modeling에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!