You are on page 1of 4

Basic concepts of OOPs

Chapter 5 [2+5=7]
----------------------------------------------------------------------------------------------------------------------

Introduction: Object oriented programming is a principal of design and development


of programs using modular approach. Some of object oriented programming languages
are JAVA, C++, COBOL and C# etc.

Basic concepts / characteristics of OOPs.


1. Objects
2. Classes
3. Data abstraction
4. Data encapsulation
5. Inheritance
6. Overloading
7. Polymorphism
8. Dynamic binding
9. Message passing

Objects:
• Objects are basic building blocks for designing programs. An object may
represent a person, place or a table of data.
• Every object has to be given the unique name.
• Objects are saved in memory and associated with address.
• During execution of program objects will communicate with each other by sending
message to one another.
Classes:
• A class is a way of grouping objects having similar characteristics.
• Once a class is defined any number of objects can be created.
• Classes are user defined data types where it can hold both data and functions.
Data abstraction:
• Abstraction refers to the process of representing essential features without
including background details.
• Data abstraction permits user to use the objects without knowing its internal
working.
Data encapsulation:
• Data encapsulation combines data and functions into a single unit called class.
• It will prevent direct access of data.
• Data can be accessed only using member function of the class.
• It enables information hiding or data hiding.

Inheritance:

Chapter 5 Oops concepts 1


• Forming a new class from an existing class is known as inheritance.
• The object of one class acquires the properties of another class through
inheritance.
• The existing class is known as base class and new class is known as derived
class.
• Inheritance provides idea of code reusability.

Overloading:
• Overloading allows objects to have different meaning on different context.
• Types of overloading:
➢ Operator overloading: When an existing operator operates on new data
type it is called operator overloading.
➢ Function overloading: When two or more function have same name but
differ in the number of arguments then its function overloading.

Polymorphism:
• It’s a feature where a function can take multiple forms based on the type of
arguments, number of arguments and data type of return value.
• The ability of operator and function to take multiple forms is known as
polymorphism.

Dynamic binding:
• Binding is the process of connecting one program to another
• Dynamic binding means code of procedure call is known at the time of
program execution.

Message passing:
• Processing of objects is done by passing messages to object.
• A message for an object is request for execution this request will involve a
function in the receiving object which generates desired result.
• Message passing involves specifying name of object, name of function and
information to be sent.

Advantages of OOPs:
• Modularity based on class and object principle is followed.
• Code reusability to avoid code duplication.
• Encapsulation provides security of data from being used by non member
function of class.
• Easier to develop complex software because inheritance helps to overcome code
complexity.
• Object specification and implementation are separated by concept abstraction.
• Development time of software is reduced because creation and implementation
is easy.

Chapter 5 Oops concepts 2


• OOP can communicate through message passing which makes description of
interface outside the system very easy.

Limitations of OOPs:

• No set standards.
• Flow diagram of OOP is complex.
• Converting real world problem to OOP is difficult.
• Classes are more generalized.

Applications of OOP:
• Computer graphic applications.
• CAD/CAM soft wares
• Object oriented database
• Windows development.
• Real time systems.
• Simulation or modeling
• Artificial intelligence and expert systems

Difference between procedure oriented programming and object oriented


programming

procedure oriented programming object oriented programming


Large programs are divided into smaller Programs are divided into objects
Programs known as functions
Data is not hidden and can be accessed Data is hidden and cannot be accessed
by external functions by external functions
Follows top down approach in the Follows bottom up approach in the
program design program design
Data may communicate with each other object may communicate with each other
through function through function
Emphasize is on procedure rather than Emphasize is on data rather than
data procedure

Assignment

Two marks questions

Chapter 5 Oops concepts 3


1. Explain data encapsulation.
2. Briefly discuss the classes in OOPs.
3. Difference between base and derived class.
4. What is object?
5. Define the term polymorphism.
6. Mention two applications of OOPs,
7. Define data abstraction and data encapsulation.

Five marks questions

1. Explain advantages of OOPs.


2. Mention five applications of OOPs.
3. Explain defining objects of a class with syntax and a programming example.
4. Explain OOPs concepts.
5. Write difference between procedural and OOPs programming.
6. Explain characteristics of OOPs.

Chapter 5 Oops concepts 4

You might also like