Warm-up Exercises
Questions
-
Explain why variables are private and methods are public in object oriented languages.
Solution
Variables are kept private to prevent their modification by external code or programs. Methods are left public because they are designated to allow external code or programs to interact with the contents of a class or object.
Explain the difference between public property and public auto-implemented property.
Solution
- What, if any, is the difference between a parameter and an argument?
Solution
A parameter is the placeholder for an argument in a method definition, and an argument is the actual value passed into a method call.