Domanda

I was wondering the following question as i cannot check into it myself at this time.

Say i have a class A which embeds another (private) class B with a (private) field B_F. I made the B class private so i can change it via the property accessors to add additional algorithms before actually returning/assigning the value. There is also the same kind of logic for field B_F in B - the field is private and uses an accessor. The question is: if i do this A.B.B_F = new_value, will it also trigger the "set" accessor in the A class for the embedded class B?

È stato utile?

Soluzione

if i do this A.B.B_F = new_value, will it also trigger the "set" accessor in the A class for the embedded class B?

No. You will only do that when you assign a value to A.B directly, not for any of its child properties.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top