chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes
I'm wandering whether i can be sure a object is newed. when a private field is used, No way to ensure the field is assigned, therefore can i ensure by asserting a constructor is invoked??
Or , any way to get the private field value?
asked by marcusmh (12.1k points)

1 Answer

0 votes
Hi,

You can't check if the c'tor was called, but you can check if the field is assigned by using the object state API as described here.

Please let me know if it helps,
answered by NofarC (4k points)
...