P. 1
Object Orientated Principles

Object Orientated Principles

|Views: 4|Likes:
Published by kd286

More info:

Published by: kd286 on Jan 14, 2013
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less





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

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

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->