HSC Stuff > HSC Software Design and Development
HSC Software Design and Development - State Ranker QnA
Opengangs:
--- Quote from: DrDusk on October 26, 2018, 09:15:22 pm ---Thank you very much for the answer. Its making sense but the scenario mentions nothing about other methods that can access the array so how can we just assume?
--- End quote ---
The question states that it's a fragment of code - so we're not given the full code, only a portion of the implementation. So we can assume there are other methods that enact on the code provided! :)
DrDusk:
Ah I see but then in this question from the 2014 hsc, why cant we just move the open_account method to the private class, so it cannot be accessed by FastCash?
Also the answer says add an empty version of the open_account method to the private section of FastCash, but if were adding an empty version why does it need to be in the private section? , because if it is empty then it wont perform any function for the FastCash class anyway.
Sorry for the barrage of questions, this topic was not taught to me very nicely :(
Thanks,
Opengangs:
--- Quote from: DrDusk on October 26, 2018, 09:45:47 pm ---Ah I see but then in this question from the 2014 hsc, why cant we just move the open_account method to the private class, so it cannot be accessed by FastCash?
Also the answer says add an empty version of the open_account method to the private section of FastCash, but if were adding an empty version why does it need to be in the private section? , because if it is empty then it wont perform any function for the FastCash class anyway.
Sorry for the barrage of questions, this topic was not taught to me very nicely :(
Thanks,
--- End quote ---
Hey, no need to apologise! That's why we're here to help :-)
This is a difficult concept to grasp so here goes my best explanation!
Remember that tellers can open accounts; FastCash cannot! So if we place the "open_account" method to the private class, then we're saying that both types of tellers (normal and FastCash) cannot open accounts. But clearly only the FastCash teller can't open accounts. So what do we do? Yes! We have to create the "open_account" method for FastCash to be placed in the private section so that FastCash cannot access it!
As for your second question, FastCash IS a subclass of teller. So in fact, if we call the method "open_account", FastCash will immediately respond to it only because it's been instantiated LIKE a teller. So what we need to do is to move the "open_account" method to the private class so that if we do call a FastCash teller to open the account, it cannot!
Hopefully, this clears any misconceptions up! :-)
cthulu:
Hey @opengangs,
I saw you mention bogosort and it made me wonder if you marked the last Alcon. I'm curious if my attempt at the sort was somewhat correct.
Cheers!
Opengangs:
--- Quote from: cthulu on October 26, 2018, 10:54:43 pm ---Hey @opengangs,
I saw you mention bogosort and it made me wonder if you marked the last Alcon. I'm curious if my attempt at the sort was somewhat correct.
Cheers!
--- End quote ---
Hey, cthulu!
Ah yes - thank you for reminding me! I shall get to that sometime tomorrow :-)
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version