general oop concept (2).pdf - kvvp

3 downloads 1697 Views 45KB Size Report
General OOP Concept. C++. C= C+1. HLL (according to programming paradigm). Procedure Programming Language. Object Base Programming Language.
General OOP Concept C++ HLL

C= C+1 (according to programming paradigm) Procedure Programming Language Object Base Programming Language Object Oriented Programming Language (OOPs) →

Object



Class



Five OOPs Concept →

Data Abstraction



Data Evaluation



Modularity



Inheritance



Polymorphism

Programming Paradigm It means organizing principles of program. It is an approach to programming. Approach used to construct or design program is called programming paradigm. A program in a procedural language is a list of instructions where each statement tells the computer to do something. The focus is on the processing, the algorithm needed to perform the desired computation. Ex. – C language

Modular Programming (Object Base) In modular programming, a large program is broken down into small units, i.e., function (sub-program). Module A set of related procedure with the data they manipulate is called a Module.

Object Oriented Programming Object

Object is an identifiable entity with some characteristics & behavior.

In OOP, the characteristics of an object are represented by its data & its behavior in represented by its functions associated. Program

Characteristics data + a, b

procedure Behavior

object

c = a+b

Function 1

Procedure

Data 1

Function 2

Data 2

Function 3

Data 3

All the data openly available for all functions. F1 & f3 are correlated.

Class

A class is a template/blue-print representing a group of object that

share common properties and relationship. Ex. –

class

xyz (name of class)

{ int a, b, c; ] public : void get data ( ); void put data ( ); }; Combination of data and procedure is object.

Basic concept of OOP (i)

Data Abstraction

(ii)

Data Encapsulation

(iii)

Modularity

(iv)

Inheritance

(v)

Polymorphism

Abstraction refers to the act of representing essential features without including the background details or explanations. Data Encapsulation The wrapping up of a data and operations/functions (that operate on the data)into a single unit called (called class) is known as Encapsulation.

Implementation of encapsulation in C++ Class, structure

Modularity It is the property of a system to decompose large program into small sub programs (functions) or co-related modules.

Implementation of Modularity in C++ Functions Inheritance It is the capability of one class of things to inherit access capabilities from another class.

Class A

Base class (Parent class, Super class)

Class B

Sub class Child class Automobiles

Car

Bus

Reusability is implemented with the help of inheritance. Reusability comes with inheritance. Polymorphism It is the ability for a message or data to be processed in new than one form. It is implemented with help of function overloading.

Advantage & disadvantage of OOPS Advantages:a) It models real could well. b) With OOP, programs are easy to understand. c) OOP offers classes reusability. Already created classes can be reused without having to write than again. d) With OOP, programs are easier to test manage and maintain. Disadvantages:a) With OOP, classes tend to be overly generalized. b) The relation among classes becomes artificial at time. c) The OOP program design is tricky. d) To do proper planning and proper design for OOP programming.