필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Reusing getters for every property of a class. (For verifying an object state.)

조회 수: 1 (최근 30일)
Lockywolf
Lockywolf 2019년 2월 26일
마감: MATLAB Answer Bot 2021년 8월 20일
I have a fairly complicated Matlab class with many properties, which are classes themselves.
In total, the amount of properties in my structure is about 200.
I need the user (caller) of the to set them all, but because there are so many of them, it is very easy to forget some.
Initially every property is set to NaN, and what I want is to have a check on every access to every property:
if isnan( this.%property_name%)
error( '%property_name% is unset )
end
So that the user would be able to have some feedback, istead of having to dig through the code with a debugger.
Is there any convenient way of achieving this?ge

답변 (0개)

이 질문은 마감되었습니다.

제품


릴리스

R2013a

Community Treasure Hunt

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

Start Hunting!

Translated by