@Opengangs so method inside a private class can be accessed but its data cannot be altered.
Firstly what do you mean by altered? Do you mean that it cannot be processed differently depending on what class?, i.e. you cannot use polymorphism on it
Secondly the sample answer says place the open_account method in the private section so it cannot be accessed, but this contradicts that it can be accessed but not altered.
Methods and data in the private class can be accessed if it is under the same outer class.
As an example, let's say I have an outerclass called "OC" and it has a private and public subclass.
Any method called in the public subclass of "OC" can access (but cannot change) the data in the private subclass. This is because all methods in the public subclass belong to the same class "OC".
But if you were to have a totally new class "OC2", then the data from the private subclass in "OC" cannot be accessed by this new class!
So in our example, we have two different classes and although FastCash IS a Teller, they're still two completely separate classes. This means that data in the private subclass of FastCash cannot be accessed by Teller and vice versa. But any methods in the public section of FastCash can still access these data.
This is really important in the case where you have encryption and decryption or storage - you still want to be able to retrieve information about (for example) your bank details but you don't want any methods from changing the data. So by placing it in the private class, you restrict access from a third party class/method from gaining access.
So by placing the empty "open_account" method into the private subclass of FastCash does 2 things:
1) Any class that is not FastCash has no way in retrieving the data in "open_account".
2) No methods IN the FastCash class can change information about it.
Hopefully, this clears up any problems!