Download presentation
Presentation is loading. Please wait.
Published byProsper Roberts Modified over 9 years ago
1
Object Oriented Programming Lecturer: Andreas P. Adi and@gradien.com
2
About the Lecture Reference: C++ How To Program, 5ed Deitel & Deitel, Pearson Education Grade: Mid exam 30%, Final exam 40%, Assignment 30% (incl. class activities) Rules: University standard rules (minimum attendance, coming late, ethics, etc) No noises, no cheating.
3
Introduction to OOP
4
C++ is an extension of C, provides capabilities for OOP. Building software quickly, correctly and economically more powerful software Objects are essentially reusable software components that model items in the real world. Object-oriented programs are easier to understand, correct and modify.
5
Software Reuse C++ programs consist of pieces called classes and functions. Programmers can write classes and functions, and use those in the C++ Standard Library. Use a "building-block" approach to create programs. Avoid reinventing the wheel. Use existing pieces wherever possible. software reuse
6
Why Objetcs? We live in a world of objects. Cars, planes, people, animals, buildings, traffic lights, etc. Programming languages (Basic, C, etc) were focussed on actions (verbs) rather than on things or objects (nouns). Program units do not easily mirror real-world entities effectively not reusable. With object technology, the software entities (classes) tend to be more reusable. More understandable, better organized and easier to maintain, modify and debug.
7
Basic Object Technology Concepts In the real world you see objects: people, animals, plants, cars, planes, buildings, etc. Objetcs have attributes (e.g., size, shape, color), and exhibit behaviors (e.g., a ball rolls, bounces; a baby cries, sleeps; a car accelerates, brakes, turns). Different objects can have similar attributes and behaviors (e.g., babies - adults, humans – chimpanzees)
8
Object-oriented design (OOD): - class relationships (objects of a certain class have the same characteristics): cars, trucks, bus vehicle Inheritance : new classes of objects are derived by absorbing characteristics of existing classes and adding unique characteristics of their own. - communication between objects (via messages): bank account message “check balance” - encapsulates (i.e., wraps) attributes and operations (behaviors) into objects. Information hiding objects communicate with one another via interfaces without knowing the implementation (analogy: brake pedal)
9
Classes, Data Members, Member Functions The data components of a class are called data members. E.g., bank account class: account number, balance. The function components of a class are called member functions (methods). E.g., check / increasing the balance. Classes are to objects as blueprints are to houses - a class is a "plan" for building an object. Classes have relationships (associations) with other classes. E.g., "bank teller" and "customer"
10
Intro to Object-Oriented Analysis and Design OOAD: process of analyzing a problem and developing an approach for solving it. UML (Unified Modeling language): a graphical language for communicating the results of any OOAD process.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.