0% found this document useful (0 votes)
20 views

Chap - 6 - Basic Concepts of Oops

Uploaded by

purvikablore
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Chap - 6 - Basic Concepts of Oops

Uploaded by

purvikablore
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Chapter

6
Basic concepts of
OOPS

Evolution of Programming Technique

Computing is a constantly changing our world and our environment. In 1950s the
machine languages were common. In 1960s high level languages which made
programming simpler were common. In 1970s the structured programming’s become
accepted standard for large complex computer programs. In 1980s modular programming
such as ADA, Modula 2 was developed. In 1990s OOPs idea was develop and was used in
development from 2000 onwards.

PROCEDURAL TECHNIQUE

This technique gives importance to the procedure or logic of solving a problem. The
logic is expressed in terms of the series of steps to achieve the desire output. This
technique uses programming constructs such as sequence, selection & iteration to
generate a solution. The programmer creates the list of instructions and the computer
carries them out. Disadvantage of this technique is, it was observed to have badly
organized & program was more complex.

STRUCTURED PROGRAMMING

The concept of structured programming focuses a lot on the methodologies or


techniques of developing good computer programs and not on only solving the program.
Structured programming deals only with logic and code. Structured program can be
written using sequence, selection & iteration but also in small executable module.

Characteristic of structured programming

➢ Large programs are divided into smaller program known as function

➢ Most of the function share global data

➢ Data moves openly around the system from one function to other.

➢ Employs top down approach in program design.

The main disadvantage of this approach was there is no restriction as to who can access
the data.

1 Savitha Parthasarathy , Head of Dept of CS


Basic Concepts of OOPS

OBJECT ORIENTED PROGRAMMING

Before starting to learn C++ it is essential that one must have a basic knowledge of
the concepts of Object Oriented Programming (OOPS). Object oriented programming is
the principal of design and development of program using modular approach. OOPS
provides advantages in creation and development of software for real life applications. The
advantage is that small modules of program can be developed in shorter span of time and
these modules of programs can be shared by a number of applications.

The fundamental idea behind Object oriented programming Languages is to


combine both data and the functions into a single unit to operate on data. This unit is
called a class. The function of a class is called as Member Function & object are only the
way to access the data of that class. Let say if you want to access the data, you call a
member function & member function in turn will access the data and give the value to
you. That means you cannot directly access any data. Thus the data is hidden and this
avoids misuse or accidentally damage of data. Data and its functions are thus said to be
encapsulated in a single entity. Data encapsulation and data hiding are key terms of
Object Oriented Programming Languages.

Basic Concepts of OOPS

The following are the major characteristics of any Object Oriented Programming
Language. They are

1. Objects. 6. Overloading.
2. Classes. 7. Polymorphism.
3. Data abstraction. 8. Dynamic Binding.
4. Data Encapsulation . 9. Message Passing.
5. Inheritance.

1. Object:

Object is the basic unit of Object Oriented programming. An object is a collection


of data elements and an associated member function (Or) Object is an instance of a
class. Each object is identified by a unique name. Every object must be member of a
particular class. Example: Apple, Orange, Mango are called as object of a particular class
fruit. At the time of execution of the program, the object interacts by sending messages to
one another. The object can interact with one another without having to know details of
data or functions within an object.

2 Savitha Parthasarathy , Head of Dept of CS


Basic Concepts of OOPS

2 . C la s s :

Classes are user defined datatypes. A class can hold both Data & functions.
Thus class represents a set of individual object. Characteristics of an object are
represented in a class as properties. The action that can be performed by object becomes
function of the class and is referred to as method (Member Functions).

Example : Let say we have a class of cars under which we have Maruti Suzuki,
Scorpio & Innova represents individual object. In this context each car will have its own
model, year of manufacturing, color & gear type forms the properties of the class car.

Note: No memory is allocated when a class is created. Memory is allocated only when an
object is created. i.e., When an instance of a class.

3. Data Abstraction:

Data abstraction permits the user to use an object without knowing its
internal working. Abstraction refers to the process of representing essential features with
including background details or explanation.

4. Data Encapsulation:

Data Encapsulation combines data & functions into single unit called class. Data
encapsulation will prevent direct access to data. The data can be accessed only through
methods (Functions) present inside the class. The data cannot be modified by an external
force non-member function of the class. Data encapsulation enables data hiding or
information hiding.

5. Inheritance:

An inheritance is the capability of a class to inherit the properties of another


class (or) Inheritance is the process of creating a new class from an existing base
class. The class which inherits the properties is called derived class or sub class. The
class from which properties are inherited is called base class or parent class or super
class.

6. Overloading:

Overloading allows objects to have different meaning depending upon context.


There are 2 types of overloading namely

3 Savitha Parthasarathy , Head of Dept of CS


Basic Concepts of OOPS

➢ Operator Overloading : When an existing operator operates on new datatypes it is


called as operator overloading

➢ Function Overloading: Function overloading means two or more function have


same name but differ in the number of arguments or different datatypes. Therefore
it is said that function name is overloaded.

7. Polymorphism:

Polymorphism is a feature of the object oriented programming where the function


can take multiple forms based on the type of arguments, number of arguments and data
type of return values. The ability of an operator and function to take multiple forms
is known as Polymorphism.

8. Dynamic Binding:

Binding is the process of connecting one program to another. Dynamic binding


means code associated with a procedure call is known only at the time of program
execution routine.

9. Message passing:

In Oops processing data is done by sending messages to objects. A message for an


object is requested for execution of procedure. The request will involve a procedure in the
receiving object that generates desired output. Message passing involves specifying the
name of object, the name of the function and information to be sent

ADVANTAGES OF OOPS

1. Simplicity → creation and implementation of Oops code is easy and reduces software
development time.

2. Modularity → Programming is easy due to modularized approach because larger


problems are converted into smaller and simplifier problems.

3. Extensibility → Adding new features to existing one is very easy.

4. Reusability → Code reusability reduces the software development time

5. Data hiding & Data security → it provides the high security by hiding the data
member from accidental access.

4 Savitha Parthasarathy , Head of Dept of CS


Basic Concepts of OOPS

6. Reduce complexity → Easier to develop complex software because complexity can be


minimized through inheritance.

DISADVANTAGE / Limitations of OOPS

1. Larger program size – OOPs involve more lines of codes than procedural program.

2. Slower Programming – OOPS are typically slower than procedure based program.

3. OOPS software development, debugging and testing are not standardized.

4. OOP is not suitable for all types of problems.

5. Polymorphism & Dynamic binding also require long processing time.

Application of OOPS

➢ Computer Graphics applications.

➢ CAD/CAM software.

➢ User interface design such as windows.

➢ Real time System Designs.

➢ Client – Server Systems.

➢ Hypertext & in Hypermedia.

➢ Artificial intelligence and expert systems.

POINTS TO REMEMBER

✓ Oops - is object oriented programming that uses object to design applications and
computer programs.

✓ Object is an instance of a class.

✓ Class is a collection of objects of similar type. It combines both data & function in a
single unit.

✓ Data Abstraction refers to the act of representing essential features without including
the background details or Data hiring.

✓ Data Encapsulation is way of combining data and associated functions into single
unit.

✓ Inheritance is the capability of a class to inherit the properties of another class.


5 Savitha Parthasarathy , Head of Dept of CS
Basic Concepts of OOPS

✓ Polymorphism is the ability of a function to have same name and multiple forms.

✓ Difference between programming & Object oriented programming.

Important questions

Two marks questions

1. What is the difference between program module and an object?


2. Characteristics of structured programming?
3. Mention different types of inheritance.
3. Mention any 2 advantages of object oriented programming over earlier programming
methods.

FIVE marks questions

1. Explain Characteristics of OOPS.


2. Write the differences between procedural programming and object oriented
programming.
3. Explain advantages and disadvantage of OOP’s
4. Write applications of object oriented programming

6 Savitha Parthasarathy , Head of Dept of CS

You might also like