Chap - 6 - Basic Concepts of Oops
Chap - 6 - Basic Concepts of Oops
6
Basic concepts of
OOPS
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
➢ Data moves openly around the system from one function to other.
The main disadvantage of this approach was there is no restriction as to who can access
the data.
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 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:
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:
6. Overloading:
7. Polymorphism:
8. Dynamic Binding:
9. Message passing:
ADVANTAGES OF OOPS
1. Simplicity → creation and implementation of Oops code is easy and reduces software
development time.
5. Data hiding & Data security → it provides the high security by hiding the data
member from accidental access.
1. Larger program size – OOPs involve more lines of codes than procedural program.
2. Slower Programming – OOPS are typically slower than procedure based program.
Application of OOPS
➢ CAD/CAM software.
POINTS TO REMEMBER
✓ Oops - is object oriented programming that uses object to design applications and
computer programs.
✓ 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.
✓ Polymorphism is the ability of a function to have same name and multiple forms.
Important questions