Presentation is loading. Please wait.

Presentation is loading. Please wait.

Object Oriented Programming

Similar presentations


Presentation on theme: "Object Oriented Programming"— Presentation transcript:

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


Download ppt "Object Oriented Programming"

Similar presentations


Ads by Google