Hands-on practice for this lecture. Work through the exercises and quizzes to reinforce what you've learned.
Exercise 1 of 2
Design a 2D and 3D coordinate system using inheritance, access modifiers, and method overriding.
You are building a geometry library. Point handles 2D coordinates, while ThreedPoint adds the Z-axis. Assign the correct **Access Modifiers** to satisfy the requirements.
Assign all modifiers to see results
Exercise 2 of 2
Predict the output of various reference vs. instance combinations. Master shadowing, hiding, and overriding.
Child reference, Child instance
// Analyzing: C obj = new C(); obj.d1; obj.d; obj.fun1(); obj.fun(); obj.sfun;
"Variables hide based on the Left Side (Ref). Methods override based on the Right Side (Heap). Static follows the Left Side."
Reference vs. Instance Simulation
Practical exercises to master the concepts.
Create a SecurityGuard class. Use private for the password, protected for clearanceLevel, and public for name.