Sunteți pe pagina 1din 2

Object Orientated Principles 1.

Characteristics of an Object Orientated Language(If any of these are missing, the language is called Object Based e.g. VB has no inheritance) a. Abstraction i. Modelling the real world in a computer system using classes and interfaces ii. A language that defines an object iii. Levels may differ determining what your viewpoint is b. Encapsulation i. Object will have a single purpose ii. Everything is contained within one object - Cohesion : how well it does something - Coupling : how well it integrates/connects iii. Hiding of Member Data and Methods(Implementation) e.g. private variables, getters and setters methods c. Inheritance 1. Is when a derived/sub/child class takes on the parent/superclass public and protected behaviors(methods) and characteristics(data members) 2. IS-A relationship e.g. A phone is a device 3. Can also override methods d. Polymorphism i. Ability of related classes to respond differently to a same message ii. Overriding is when a method in a derived/descendant class has the same method signature of parameters as the parent class, but different behavior e.g. 1. Abstract methods (overridden by classes that extends) 2. Interfaces (must be implemented by implementing classes) iii. Also called dynamic/late/run-time binding , because it determines which method body to bind the method call to only at run-time. 2. Terms a. Object : Something that has characteristics(state) and behavior(methods) e.g. bicycle : Instance of a class i.e. characteristics(state) is specific for an object e.g. color, .Used to model real-world objects you find in everyday life.

b. Class :- template/blueprint/prototype for an object e.g recipe-class, pie-object - group of objects with the same characteristics and behavior - Abstract Class : Not instantiable, base class, to inherit from - Final Class : Cannot inherit from

c. Message : Software objects interact and communicate with each other using messages. This is presented by the methods that an object has. Sometimes extra information is sent along with the method and this is represented by the parameters of the method d. Interface : describes how we interact with an object When a class implements an interface, it promises to implement all of the methods declared in that interface e. Member Method.(behaviors) - Final Cannot override it -Abstract No implementation. - Static Can be called without class being instantiated - Override : for same method, same signature, different implementation in inherited class - Overload : for same method , different signature, different implementation in the same class f. Member Data(variables/properties/attributes) - Final Cannot be changed - Static Can be called without class being instantiated - Public, Protected(inheritance), Package, Private, Published g. Interface is a PureAbstract Class, no methods are implemented

S-ar putea să vă placă și