Can I find out if a class is an abstract class before trying to instantiate it?
이전 댓글 표시
Can i somehow say:
if isAbstract(className)
% do something
else
% do something else
end
채택된 답변
추가 답변 (4개)
Image Analyst
2012년 7월 17일
0 개 추천
I don't think so. But you should know just by looking at the code, or just try it and see. Why would you ever not know what you're calling and have to use the test you you described? Worst case, you could wrap your method call in a try/catch to do what you want, but I would recommend knowing beforehand than doing that.
Daniel Shub
2012년 7월 18일
0 개 추천
It might be quicker to try and create the object in a try-catch and deal with errors when they happen.
카테고리
도움말 센터 및 File Exchange에서 Whos에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!