OOP – Encapsulation – Q&A

Question 1[2 marks]
What code would you write to instantiate two new padlocks: One called bikeLock that is already locked with a combination of 4321 and one called gardenShedLock that is unlocked with a combination of 1234?
Question 2[4 marks]
Explain using an example from the above code for the Padlock class, what is meant by encapsulation.
Save / Share Answers as a link
unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members Area
Tagged with: , ,