Contact : +88 01840-723661

|

Email : info@jakafind.com

Object Oriented Programming Basic

Object Oriented Programming

Basic features of SPM

  • Emphasis on doing algorithms.
  • Large Programs are divided into smaller programs known as Functions
  • Most of the function shares global data.
  • Data move around the system globally from function to function.
  • Function transfers the data from one form to another.
  • Employs top-down approach of Programming

Example: C, Pascal, FORTRAN

Problems with Structured Programming Methodology (SPM)

  • Reach their limit when project becomes too large.
  • Large program became more complex.
  • Functions have unrestricted access to global data.

 

The striking features of OOP

  • Emphasis on data rather than the procedure.
  • Programs are centered on objects.
  • Data are hidden and can’t be accessed by external functions
  • Object may communicate with each other through methods (functions).
  • New data & functions can be easily added whenever necessary.

Concepts of OOP

  • Object
  • Class
  • Methods
  • Instance Variables (Properties)

 

01. Object

  • Real world entity.
  • Bundle of related variables and functions (also known methods).
  • Objects share two characteristics:
  1. Properties / State
  2. Method / Behavior (Functionalities)

Two characteristics of Object

  • Objects share two characteristics:
  1. Properties / State 
  • State is a well-defined condition of an item. 
  • A state captures the relevant aspects of an   object
  1. Method / Behavior (Functionalities)
  • Behavior is the observable effects of an operation or event

Example

Object:            House

States:            Color and Location

Behaviors:   Close/open doors

02. Class

A class can be defined as a template/blueprint of an object that describes the behaviors/states that object.

Detailing Objects

Account:

Has : A/C Number, Balance, Opening Date, Account Holder details

Does: Deposit money, Withdraw money

Employee

Branch:

Has: Name, Location, No of accounts

Does: Create new accounts, make transaction

Employee:

Has: name, id, email, salary

Does: Handle banking transactions

Account Holder:

Has: name, contact
no, accounts

Does: Handle banking transactions

Basic concepts of OOP

  • Object
  • Class
  • Methods
  • Instance Variables

 

Object

 

  • Real world entity.
  • Bundle of related variables and functions (also known methods).
  • Objects share two characteristics:
  1. Properties / State
  2. Method / Behavior (Functionalities)

Class

A class can be defined as a template/blueprint of an object that describes the behaviors/states that object.

Methods

  • A method is basically a behavior.
  • A class can contain many methods.
  • It is in methods where the logics are written, data is manipulated and all the actions are executed.

Instance Variables

Each object has its unique set of instance variables

Such as, 

A Box can have Height, Width, Depth

These are the Instance variables of that box.

An object’s state is created by the values assigned to these instance variables.

Basic Features of OOP

  • Abstraction
  • Encapsulation
  • Polymorphism
  • Inheritance

Inheritance

 

  • Inheritance is when an object acquires the property of another object.
  • Inherited class is called as parent class or super class or base class
  • Class that inherits a parent class is called as child class or sub class or derived class

 

Thank You!

 

Leave a Reply

Your email address will not be published. Required fields are marked *