0% found this document useful (0 votes)
31 views8 pages

Lecture 12

This document provides an introduction to object oriented programming (OOP). It defines OOP as a programming paradigm that uses objects, which consist of bundled data and methods. The key concepts of OOP discussed include classes, which define the properties and behaviors of objects, instances, which are actual objects created at runtime from classes, and methods, which are functions that objects can perform. An example used is the Dog class having properties like breed and methods like bark().

Uploaded by

Abby
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views8 pages

Lecture 12

This document provides an introduction to object oriented programming (OOP). It defines OOP as a programming paradigm that uses objects, which consist of bundled data and methods. The key concepts of OOP discussed include classes, which define the properties and behaviors of objects, instances, which are actual objects created at runtime from classes, and methods, which are functions that objects can perform. An example used is the Dog class having properties like breed and methods like bark().

Uploaded by

Abby
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

2/8/2012

Lecture 12: Object Oriented Programming

Introduction to Computer
Programming for Engineering

Lecture 12: Object Oriented Programming

WHAT IS OOP?

1
2/8/2012

What is a OOP?

 A programming paradigm that uses


"objects" – data structures consisting of
data fields and methods together with
their interactions – to design applications
and computer programs..

Programming Paradigm

 A programming paradigm is a fundamental


style of computer programming.

 Compare with a methodology, which is a


style of solving specific software
engineering problems.

2
2/8/2012

OOP compared to Procedural


Programming

 The focus of object-oriented


programming it is to break down a
programming task into objects with each
"object" encapsulating its own data and
methods (subroutines).

Lecture 12: Object Oriented Programming

WHAT IS AN OBJECT?

3
2/8/2012

What is an Object?

 A discrete bundle of functions and


procedures, often relating to a particular
real-world concept such as a teacher or
student.

Lecture 12: Object Oriented Programming

FUNDAMENTAL
CONCEPTS

4
2/8/2012

Class

 A user defined datatype which contains


the variables, properties and methods in
it.

Class

 A class defines the abstract


characteristics of a thing (object),
including its:
◦ Properties
◦ Methods

5
2/8/2012

Class
• Characteristics
Properties • Attributes

• Behaviors
Methods • Functions /
Operations

Class
 For example, the class Dog would consist
of traits shared by all dogs such as:
◦ breed and fur color (properties)
◦ the ability to bark and sit
(methods/behavior).

6
2/8/2012

Instance

 The Instance is the ACTUAL OBJECT


created at run-time

Instance

 For example, the Akamaru object is an


instance of the Dog class.

7
2/8/2012

Method
 Method is a set of procedural statements
for achieving the desired result.
 It performs different kinds of operations
on different data types.
 In a programming language, methods
(sometimes referred to as "functions") are
verbs.

Method
 Akamaru, being a Dog, has the ability to
bark. So bark() is one of Akamaru's
methods.

 She may have other methods as well, for


example
◦ sit()
◦ eat()
◦ walk()
◦ save(Timmy).

You might also like