34,333
edits
Changes
→Accessing C# Object Members
This approach works well for ''public'' class members, but not for ''private'' members. An attempt, for example, to use dot notation to access the private ''accountNumber'' member will result in a compilation error along the the lines of:
<tt>error CS0122: 'Hello.BankAccount.accountNumber' is inaccessible due to its protection level</tt>
In order to access ''private'' members we need to provide access methods in the class.