Download presentation
Presentation is loading. Please wait.
1
Object Oriented Programming
Prototype based vs class based OOP Prototype based OOP - cloning, virtual and copied fields and methods SELF Problems: code is not shared, too dynamic
2
Class based OOP Classes vs instances Only classes have code
Only classes inherit Instances have state variables Variations in instances implemented as values of state variables.
3
Inheritance Type vs Implementation inheritance
Types: roles that an object can have -> INTERFACES Organized as a DAG i.e. multiple inheritance for types is relatively trouble free. Classes: implement code – single inheritance: controls complexity adds security
4
Accessibility of methods and variables in a class
Final Ex: security manager Public,private,protected,default Absolute: public, private Dependent on Packages: default, protected
5
Class vs instance (Static vs. dynamic) fields/vars and methods
Class variables: shared among all instance – visible to all instances Ex: instance counter Ex: security manager – final!
6
Inheriting Methods Virtual methods – all java instance methods are virtual Extra (hidden) parameter: this search for an absent method or field always starts from the class associated with “this” Ex: Circle extends Point -> hide(), show(), moveTo(x,y) – virtual, uses hide() and show() as defined based on the “this” parameter
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.