Object-Oriented Programming is centered
around the new concepts such as classes, polymorphism, inheritance, etc.
it is a well suited paradigm for the following:
- Modeling
the real world problem as close as possible to the
users perspective.
- Interacting
easily with computational environment using familiar metaphors
- Constructing
reusable software components and easily extendable
libraries.
- Easily
modifying and extending implementations of components without having to
recode every thing from scratch.
Definition of OOP: OOP uses objects as its fundamental building blocks.
Each object is an instance of some class. Classes allow the mechanism of data
abstraction for creating new data types. Inheritance allows building of new classes
from existing classes. Hence if any of these elements are missing in a program
we cannot consider that program as objected oriented program.
Object oriented programming is a programming methodology that associates data structures with a set of operators which act upon it. In OOP’s terminology an instance of such an entity is known as an object. It gives importance to relationships between objects rather than implementation details. Hiding the implementation details within an object results in the user being more concerned with an objects relationship to the rest of the system, than the implementation of the object’s behavior.
Object oriented programming is a programming methodology that associates data structures with a set of operators which act upon it. In OOP’s terminology an instance of such an entity is known as an object. It gives importance to relationships between objects rather than implementation details. Hiding the implementation details within an object results in the user being more concerned with an objects relationship to the rest of the system, than the implementation of the object’s behavior.
Basic
concepts of OOPS and Structure of C++ program
Here you will learn about Objects, Classes,
Inheritance, Data Abstraction, Data Encapsulation, Polymorphism, Overloading,
Reusability.
Before starting to learn C++ it is essential that we must have a basic knowledge of the concepts of Object oriented programming. Some of the important object oriented features are namely:
Before starting to learn C++ it is essential that we must have a basic knowledge of the concepts of Object oriented programming. Some of the important object oriented features are namely:
- Objects
- Classes
- Inheritance
- Data
Abstraction
- Data
Encapsulation
- Polymorphism
- Overloading
- Reusability
In order to understand the basic concepts in C++,
the programmer must have a command of the basic terminology in object-oriented
programming.Below is a brief outline of the concepts of
Object-oriented programming languages:
Objects: Object is the basic unit of object-oriented programming. Objects are identified by its unique name. An object represents a particular instance of a class. There can be more than one instance of an object. Each instance of an object can hold its own relevant data.
An Object is a collection of data members and associated member functions also known as methods.
Classes:
Classes are data types based on which objects
are created. Objects with similar properties and methods are grouped together
to form a Class. Thus a Class represent a set of individual objects.
Characteristics of an object are represented in a class as Properties.
The actions that can be performed by objects become functions of the class and
is referred to as Methods.
For example consider we have a Class of Cars under which Santro Xing, Alto and WaganR represents individual Objects. In this context each Car Object will have its own, Model, Year of Manufacture, Color, Top Speed, Engine Power etc., which form Properties of the Car class and the associated actions i.e., object functions like Start, Move, Stop form the Methods of Car Class.
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 is created.
Inheritance:
Inheritance is the process of forming a new
class from an existing class or base class. The base class is also
known as parent class or super class, The new class that is
formed is called derived class. Derived class is also known as a child
class or sub class. Inheritance helps in reducing the overall
code size of the program, which is an important concept in object-oriented
programming.
Data Abstraction:
Data Abstraction increases the power of
programming language by creating user defined data types. Data Abstraction also
represents the needed information in the program without presenting the
details. A data abstraction is a simplified view of an object that includes
only features one is interested in while hides away the unnecessary
details. In programming languages, a data abstraction becomes an abstract
data type or a user-defined type. In OOP, it is implemented as a class.
Data Encapsulation:
Data Encapsulation combines data and
functions into a single unit called Class. When using Data Encapsulation, data
is not accessed directly; it is only accessible through the functions present
inside the class. Data Encapsulation enables the important concept of data
hiding possible.
It is a mechanism that associates the code and the data it manipulates into a single unit to and keeps them safe from external interference and misuse. In C++ this is supported by construct called class. An instance of an object is known as object which represents a real world entity.
Polymorphism:
Polymorphism allows routines to use variables
of different types at different times. An operator or function can be given different
meanings or functions. Polymorphism refers to a single function or
multi-functioning operator performing in different ways.
Overloading:
Overloading is one type of Polymorphism. It
allows an object to have different meanings, depending on its context. When an
exiting operator or function begins to operate on new data type, or class, it
is understood to be overloaded.
Reusability:
This term refers to the ability for multiple
programmers to use the same written and debugged existing class of data. This
is a time saving device and adds code efficiency to the language. Additionally,
the programmer can incorporate new features to the existing class, further
developing the application and allowing users to achieve increased performance.
This time saving feature optimizes code, helps in gaining secured applications
and facilitates easier maintenance on the application.
Objects: Object is the basic unit of object-oriented programming. Objects are identified by its unique name. An object represents a particular instance of a class. There can be more than one instance of an object. Each instance of an object can hold its own relevant data.
An Object is a collection of data members and associated member functions also known as methods.
Classes:
For example consider we have a Class of Cars under which Santro Xing, Alto and WaganR represents individual Objects. In this context each Car Object will have its own, Model, Year of Manufacture, Color, Top Speed, Engine Power etc., which form Properties of the Car class and the associated actions i.e., object functions like Start, Move, Stop form the Methods of Car Class.
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 is created.
Inheritance:
Data Abstraction:
Data Encapsulation:
It is a mechanism that associates the code and the data it manipulates into a single unit to and keeps them safe from external interference and misuse. In C++ this is supported by construct called class. An instance of an object is known as object which represents a real world entity.
Polymorphism:
Overloading:
Reusability: