Discuss Object oriented programming in c++ with 4 points. Each point shoult not be less
than 200 words.
Question 6 (40 marks) 200-50
/* Object-oriented programming – As the name suggests uses objects in programming.
Object-oriented programming aims to implement real-world entities like inheritance,
hiding, polymorphism, etc in programming. The main aim of OOP is to bind together
the data and the functions that operate on them so that no other part of the code
can access this data except that function.
Class: The building block of C++ that leads to Object-Oriented programming is a Class.
It is a user-defined data type, which holds its own data members and member functions,
which can be accessed and used by creating an instance of that class.
Object: An Object is an identifiable entity with some characteristics and behaviour.
An Object is an instance of a Class. When a class is defined, no memory is allocated
but when it is instantiated (i.e. an object is created) memory is allocated.
Encapsulation: In normal terms, Encapsulation is defined as wrapping up of data and
information under a single unit. In Object-Oriented Programming, Encapsulation is
defined as binding together the data and the functions that manipulate them.
Encapsulation also leads to data abstraction or hiding. As using encapsulation also
hides the data.
Abstraction: Data abstraction is one of the most essential and important features
of object-oriented programming in C++. Abstraction means displaying only essential
information and hiding the details. Data abstraction refers to providing only essential
information about the data to the outside world, hiding the background details or
implementation.
Polymorphism: The word polymorphism means having many forms. In simple words, we can
define polymorphism as the ability of a message to be displayed in more than one form.
Inheritance: The capability of a class to derive properties and characteristics from
another class is called Inheritance. Inheritance is one of the most important features
of Object-Oriented Programming.
Sub Class: The class that inherits properties from another class is called Sub class
or Derived Class.
Super Class:The class whose properties are inherited by sub class is called Base Class
or Super class.
Reusability: Inheritance supports the concept of “reusability”, i.e. when we want to
create a new class and there is already a class that includes some of the code that we
want, we can derive our new class from the existing class. By doing this, we are reusing
the fields and methods of the existing class.
*/
Comments
Leave a comment