Object Oriented Programming Introduction 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. OOPs Concepts: Class Objects Data Abstraction Encapsulation Inheritance Polymorphism Dynamic Binding Message Passing
Objective Object-oriented is a software design in which we can simply group data its data types and methods under a single package. Here we will be dealing with 2 main terms: Class : Class is a blueprint of data and functions or methods. Objects : Objects are an instance of a class.
Program v s Programming program is a set of structured activities while programming is (broadcasting) the designing, scheduling or planning of a radio or television program / programme .
Programming Languages Language : It is a mode of communication that is used to share ideas, opinions with each other. For example, if we want to teach someone, we need a language that is understandable by both communicators. A programming language is a computer language that is used by programmers (developers) to communicate with computers. It is a set of instructions written in any specific language ( C, C++, Java, Python) to perform a specific task.
Structured programming Structured programming is a programming paradigm aimed at improving the clarity, quality, and development time of a computer program by making extensive use of the structured control flow constructs of selection (if/then/else) and repetition (while and for), block structures, and subroutines.
Advantages of Structured Programming Approach: Easier to read and understand User Friendly Easier to Maintain Mainly problem based instead of being machine based Development is easier as it requires less effort and time Easier to Debug Machine-Independent, mostly.
Object-Oriented Programming Paradigm Object-oriented programming is a programming paradigm built on the concept of objects that contain both data and code to modify the data. Object-oriented programming mimics a lot of the real-world attributes of objects. Some of the most widely used object-oriented programming languages are Java, C++, and Ruby.
Object-Oriented Programming Concepts
Concepts Classes and Objects Classes and objects are the two main aspects of object-oriented programming . Class Objects Fruit Apple Grapes Orange
Encapsulation 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.
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.
Inheritance I t is possible to inherit attributes and methods from one class to another. We group the "inheritance concept" into two categories: derived class (child) - the class that inherits from another class base class (parent) - the class being inherited from To inherit from a class, use the : symbol.
Polymorphism Polymorphism means "many forms", and it occurs when we have many classes that are related to each other by inheritance . Polymorphism uses those methods to perform different tasks. This allows us to perform a single action in different ways.
Benefits of OOPS Re-usability It means reusing some facilities rather than building them again and again. This is done with the use of a class. We can use it ‘n’ number of times as per our need. 2. Data Redundancy This is a condition created at the place of data storage (you can say Databases)where the same piece of data is held in two separate places. So the data redundancy is one of the greatest advantages of OOP. If a user wants a similar functionality in multiple classes, he/she can go ahead by writing common class definitions for similar functionalities and inherit them. 3. Code Maintenance This feature is more of a necessity for any programming languages; it helps users from doing re-work in many ways. It is always easy and time-saving to maintain and modify the existing codes by incorporating new changes into them. 4. Security With the use of data hiding and abstraction mechanism, we are filtering out limited data to exposure, which means we are maintaining security and providing necessary data to view.