OBJECT ORIENTED PROGRAMMING
CONTENTS Merits and Demerits of object oriented programming 04 Characteristics of object oriented language: classes and objects. encapsulation-data abstraction- inheritance - polymorphism Why object oriented programming? 01 03 02
Why object oriented programming? As the name suggests, Object-Oriented Programming or OOPs refers to languages that uses objects in programming. Object- oriented programming aims to implement real-world entities like inheritance, hiding, polymorphism etc. in programming. We can not apply OOP everywhere. It is applied only when it is required. It is not suitable for all types of problems. 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. Object Oriented programming (OOP) is a programming paradigm that relies on the concept of classes and objects. It is used to structure a software program into simple, reusable pieces of code blueprints (usually called classes), which are used to create individual instances of objects.
CLASSES A class in C++ is the building block that leads to Object- Oriented programming. 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. A C++ class is like a blueprint for an object. OBJECTS 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. Object can be created many times as per requirement // CLASS class CAR{ public: string color; string model; }; int main(){ // OBJECTS CAR FORD; FORD.color = "Green"; FORD.color = "Mustang"; CAR TOYTA; TOYTA.color = "Red"; TOYTA.model = "Prius"; CAR VOLKSWAGEN; VOLKSWAGEN.color = "Blue"; VOLKSWAGEN.model = "Golf"; PROGRAM
ENCAPSULATION In object-oriented computer programming (OOP) languages, the notion of encapsulation (or OOP Encapsulation) refers to the bundling of data, along with the methods that operate on that data, into a single unit. A class is a program-code-template that allows developers to create an object that has both variables (data) and behaviors (functions or methods). A class is an example of encapsulation in computer science in that it consists of data and methods that have been bundled into a single unit. DATA ABSTRACTION Abstraction means that the user interacts with only selected attributes and methods of an object. Abstraction uses simplified, high level tools, to access a complex object. Abstraction is using simple classes to represent complexity. Abstraction is an extension of encapsulation. For example, you don’t have to know all the details of how the engine works to drive a car. A driver only uses a small selection of tools: like gas pedal, brake, steering wheel, blinker. The engineering is hidden from the driver.
Inheritance Inheritance is the procedure in which one class inherits the attributes and methods of another class. The class whose properties and methods are inherited is known as the Parent class. And the class that inherits the properties from the parent class is the Child class. For example, a child inherits the traits of his/her parents. With inheritance, we can reuse the fields and methods of the existing class. Hence, inheritance facilitates Reusability and is an important concept of OOPs. Polymorphism A person at the same time can have different characteristics. Like a man at the same time is a father, a husband, an employee. So the same person possesses different behavior in different situations. This is called polymorphism. Polymorphism is considered one of the important features of Object-Oriented Programming. Polymorphism allows us to perform a single action in different ways. In other words, polymorphism allows you to define one interface and have multiple implementations.
Merits and Demerits of OOP MERITS •OOP language allows to break the program into the bit-sized problems that can be solved easily (one object at a time). •OOP systems can be easily upgraded from small to large systems. •It is possible that multiple instances of objects co-exist without any interference, •It is possible to map the objects in problem domain to those in the program. •The principle of data hiding helps the programmer to build secure programs which cannot be invaded by the code in other parts of the program. •By using inheritance, we can eliminate redundant code and extend the use of existing classes. •The data-centered design approach enables us to capture more details of model in an implementable form. DEMERITS •The length of the programs developed using OOP language is much larger than the procedural approach. Since the program becomes larger in size, it requires more time to be executed that leads to slower execution of the program. •We can not apply OOP everywhere as it is not a universal language. It is applied only when it is required. It is not suitable for all types of problems. •OOPs take time to get used to it. The thought process involved in object-oriented programming may not be natural for some people. •Everything is treated as object in OOP so before applying it we need to have excellent thinking in terms of objects.
CONCLUSION Object Oriented programming requires thinking about the structure of the program and planning at the beginning of coding. Looking at how to break up the requirements into simple, reusable classes that can be used to blueprint instances of objects. Overall, implementing OOP allows for better data structures and reusability, saving time in the long run.
object oriented programming(oops)

object oriented programming(oops)

  • 1.
  • 2.
    CONTENTS Merits and Demerits ofobject oriented programming 04 Characteristics of object oriented language: classes and objects. encapsulation-data abstraction- inheritance - polymorphism Why object oriented programming? 01 03 02
  • 3.
    Why object oriented programming? As thename suggests, Object-Oriented Programming or OOPs refers to languages that uses objects in programming. Object- oriented programming aims to implement real-world entities like inheritance, hiding, polymorphism etc. in programming. We can not apply OOP everywhere. It is applied only when it is required. It is not suitable for all types of problems. 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. Object Oriented programming (OOP) is a programming paradigm that relies on the concept of classes and objects. It is used to structure a software program into simple, reusable pieces of code blueprints (usually called classes), which are used to create individual instances of objects.
  • 4.
    CLASSES A class inC++ is the building block that leads to Object- Oriented programming. 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. A C++ class is like a blueprint for an object. OBJECTS 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. Object can be created many times as per requirement // CLASS class CAR{ public: string color; string model; }; int main(){ // OBJECTS CAR FORD; FORD.color = "Green"; FORD.color = "Mustang"; CAR TOYTA; TOYTA.color = "Red"; TOYTA.model = "Prius"; CAR VOLKSWAGEN; VOLKSWAGEN.color = "Blue"; VOLKSWAGEN.model = "Golf"; PROGRAM
  • 5.
    ENCAPSULATION In object-oriented computerprogramming (OOP) languages, the notion of encapsulation (or OOP Encapsulation) refers to the bundling of data, along with the methods that operate on that data, into a single unit. A class is a program-code-template that allows developers to create an object that has both variables (data) and behaviors (functions or methods). A class is an example of encapsulation in computer science in that it consists of data and methods that have been bundled into a single unit. DATA ABSTRACTION Abstraction means that the user interacts with only selected attributes and methods of an object. Abstraction uses simplified, high level tools, to access a complex object. Abstraction is using simple classes to represent complexity. Abstraction is an extension of encapsulation. For example, you don’t have to know all the details of how the engine works to drive a car. A driver only uses a small selection of tools: like gas pedal, brake, steering wheel, blinker. The engineering is hidden from the driver.
  • 6.
    Inheritance Inheritance is theprocedure in which one class inherits the attributes and methods of another class. The class whose properties and methods are inherited is known as the Parent class. And the class that inherits the properties from the parent class is the Child class. For example, a child inherits the traits of his/her parents. With inheritance, we can reuse the fields and methods of the existing class. Hence, inheritance facilitates Reusability and is an important concept of OOPs. Polymorphism A person at the same time can have different characteristics. Like a man at the same time is a father, a husband, an employee. So the same person possesses different behavior in different situations. This is called polymorphism. Polymorphism is considered one of the important features of Object-Oriented Programming. Polymorphism allows us to perform a single action in different ways. In other words, polymorphism allows you to define one interface and have multiple implementations.
  • 7.
    Merits and Demeritsof OOP MERITS •OOP language allows to break the program into the bit-sized problems that can be solved easily (one object at a time). •OOP systems can be easily upgraded from small to large systems. •It is possible that multiple instances of objects co-exist without any interference, •It is possible to map the objects in problem domain to those in the program. •The principle of data hiding helps the programmer to build secure programs which cannot be invaded by the code in other parts of the program. •By using inheritance, we can eliminate redundant code and extend the use of existing classes. •The data-centered design approach enables us to capture more details of model in an implementable form. DEMERITS •The length of the programs developed using OOP language is much larger than the procedural approach. Since the program becomes larger in size, it requires more time to be executed that leads to slower execution of the program. •We can not apply OOP everywhere as it is not a universal language. It is applied only when it is required. It is not suitable for all types of problems. •OOPs take time to get used to it. The thought process involved in object-oriented programming may not be natural for some people. •Everything is treated as object in OOP so before applying it we need to have excellent thinking in terms of objects.
  • 8.
    CONCLUSION Object Oriented programmingrequires thinking about the structure of the program and planning at the beginning of coding. Looking at how to break up the requirements into simple, reusable classes that can be used to blueprint instances of objects. Overall, implementing OOP allows for better data structures and reusability, saving time in the long run.