1. What is Object Oriented Programming?2. What is Procedure Oriented ?3. Object , Class A. Attributes (Data). B. Methods (Behaviours)4. What is class? And what’s the difference object & class?5. Principals Of OOP A. Encapsulation B. Inheritance C. Polymorphism
What OOP?1. Object means things or instance.2. Orientation means co-operative collections.3. Programming means sequence of instruction s that performs action.So Object-oriented programming is a method of implementation in which programs are organized as cooperative collections of objects, each of which represents an instance of some class, and whose classes are all members of one or more hierarchy of classes united via inheritance relationships.
What’s wrong with starting of ObjectOriented Programming? Unfortunately most of us start Object Oriented Programming (OOP) jumping into a language book like C++, Java or C# etc. But First of all we should know: what’s an object and how to think in OO (Object Oriented) way.
Everything can be an object. How?• Look around you, what we see, ALL ARE OBJECTS. We see computer,chair, table, pen, air cooler, carpet etc, all these are objects. Why they areobject? Pretty simple, they have some related attributes and some relatedactivities.• Even our concept s are also objects. Like an Account.• Is it possible that any event, like war or raining, singing, thinkingetc (which is not visible) can be object? The answer is YES. These can beobjects also. Think, raining has attributes: is it drizzling or “cats and dogs”?Singing can be an object if we consider, in which frequency-range it is sung?• So what is not object?
Let ‘s discuss an example‘Name’ – is it an attribute or an object? Actually, it is totally depend on problemdomain. See, if you are thinking about a banking solution then customer‘Name’ will be an attribute of customer. But if it a business from where you canpurchase the ‘Name’ of your new-born baby then ‘Name’ will be an object tothis business. Because ‘Name’ has meaning, length, type etc. Banking Solution Name ShopCustomer Account Name Name Length Address …………. Type Contact No ………….
What is object ? Object is the instance or real existence of class. Physical entities e.g. Submarine, Plane Roles e.g. Manager, CTO Interactions e.g. Buy, Contact Occurrences e.g. War, Rain Here, all are objects.
More about Object Object has certain characteristics Attributes Object can do something Methods Brand name RAM size Attributes Processor type OS name Can add Can subtract Computer Methods Can multiply Can divide
What is class ? And what’s the difference betweenobject & class? Class is the blue print of object. Computer My Computer Brand name Dell Inspiron RAM size 1 GB Processor type Core 2 Due OS name Windows Vista Can add Add Can subtract Subtract Can multiply Multiply Can divide Divide Class Object
Objects as instances of Classes The world conceptually consists of objects Many objects can be said to be of the same type or class My bank account, your bank account, Bill Gates’ bank account … We call the object type a class
What does come first? Class? or Object? Classes reflect concepts, objects reflectinstances that embody those concepts. object class girl Jodie Daria Jane Brittany
Review Body Anything around us can be object. Every object has some characteristics (attributes). Every object has some responsibilities (methods). Class is the blue print of object. Class is a generic form of any entity.
Principals Of OOP
There are three basic principals ofOOP Encapsulation Inheritance Polymorphism
What is encapsulation?Is the mechanism that hide complexity.It safe recourses of an object from outside interface.It works like a wrapper. The resources inside the wrapper.
More about Encapsulation. Object to object interaction or communication.
What is Inheritance?Is the process which one object acquire the properties of another objecthierarchically.
Inheritance specifies an Base Class is-a-kind-of relationship Derived classes inherit Animal properties and methods from a base class, allowing code reuse Derived classes become Elephant Cat more specialized Derived Classes
It is a Greak word that means many form.Same method s works different for different data. Animal Method Behavior Objects Called Elephant Eat () Eat Grass Cat Eat () Eat Mouse Mouse Eat () Eat Cheese