Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Functional vs Object Oriented Programming-Object Oriented Programming-Lecture Slides, Slides of Object Oriented Programming

This lecture was delivered by Dr. Jameel Ahmad at Quaid-i-Azam University for Object Oriented Programming course. It includes: Object, Oriented Programming, Introduction, Model, Syntax, Functional, Procedural, Class, Instance

Typology: Slides

2011/2012

Uploaded on 07/13/2012

saqqi
saqqi 🇵🇰

4

(33)

40 documents

1 / 13

Toggle sidebar

Related documents


Partial preview of the text

Download Functional vs Object Oriented Programming-Object Oriented Programming-Lecture Slides and more Slides Object Oriented Programming in PDF only on Docsity! 1 Object Oriented Programming Course Instructor: Mr. Shahzad Rafiq  Assist. Professor Computer Science,  Faculty of Computing, Mohammad Ali JinnahUniversity,  Islamabad. Office: 113, 1st floor, Block A. Email: [email protected] docsity.com This Week ¢ Introduction ¢ Object Orientation: Introduction to Object Model ¢ Syntax comparison of ; — Functional vs OO Programming docsity.com 5 Example Object Oriented Programming Class BankAccount { private: double balance; int accNo; public : void deposit( double amount) { balance+= amonut; } void  withdraw(double amount) { balance - = amonut; } void getBalance() { cout<<accNo<<balance; } } void  main void() { BankAccount aliAccount = new BankAccount(); BankAccount assadAccount = new BankAccount(); //Operations on ali account; aliAccount. deposit( 10000); aliAccount. deposit( 5000); aliAccount. getBalance(); aliAccount. withdraw( 1000); aliAccount. getBalance(); //Operations on assad account; assadAccount. deposit( 1000); assadAccount. deposit( 5000); assadAccount . getBalance(); assadAccount. withdraw( 1000); assadAccount. getBalance(); } docsity.com 6 Object • Object‐oriented programs use objects. • An object is a thing, both tangible and  intangible. Account, Vehicle, Employee, etc. • To create an object inside the computer  program, we must provide a definition for  objects—how they behave and what kinds of  information they maintain —called a class. • An object is called an instance of a class. docsity.com 7 Object • An object contains both data and methods  that manipulate that data – The data represent the state of the object – Data can also describe the relationships between  this object and other objects • Example: A BankAccount might have – A balance (the internal state of the account) – An account number (some object representing  an identity) docsity.com 10 All about to implement “Object Model” • Consisting of objects and  classes. Describes what will  be necessary to make the  desired software product. • The object model is the  result of OOA and OOD and  the basis for  implementation.  • There exists no standard  object model  • The following aspects  should in any case be  contained in a good object  model: Typing Abstraction Encapsulation Modularity Hierarchy Concurrency Persistence docsity.com 11 • Typing:  – “It is the enforcement of the class of an object,  such that objects of different types may not be  interchanged, or at the most, they may be  interchanged only in a very restricted ways ” • Abstraction:  – “An abstraction denotes the essential  characteristics of an object that distinguish it from  all other kinds of objects and thus provide crisply  defined conceptual boundaries, relative to the  perspective of the view”. • Encapsulation:  – “It is the process of compartmentalizing the  elements of an abstraction that constitute its  structure and behavior, it serves to separate the  contractual interface of an abstraction and its  implementation” Object Model (Continue…) docsity.com 12 Object Model (Continue…) • Modularity: – “It is the property of a system that has been decomposed  into a set of cohesive and loosely coupled modules” • Hierarchy: – “It is a ranking or ordering of abstractions” • Concurrency: – the property that distinguishes an active object form one  that is not active” • Persistence: – the property of an object through which its existence  transcends time( i.e. the object continues to exist after its  creator ceases to exist) and/or space( i.e. the object’s  location moves from address space in which it was   created)” docsity.com