Skip to content

Latest commit

 

History

History
38 lines (38 loc) · 2.57 KB

oop.md

File metadata and controls

38 lines (38 loc) · 2.57 KB

Object Oriented Programming () { The four pillars of object-oriented programming are encapsulation, abstraction, inheritance, and polymorphism. The three principles of object-oriented programming are encapsulation, inheritance, and polymorphism. } Classes () { In object-oriented programming, a class is a blueprint for creating objects (a particular data structure), providing initial values for state (member variables or attributes), and implementations of behavior (member functions or methods). The user-defined objects are created using the class keyword. } Encapsulation () { There are three types of Encapsulation. Member Variable Encapsulation. Function Encapsulation. Class Encapsulation. } Function () { A function that can evaluate to or be applied to values of different types is known as a polymorphic function. A data type that can appear to be of a generalized type (e.g. a list with elements of arbitrary type) is designated polymorphic data type like the generalized type from which such specializations are made. } Inheritance () { When a class derives from another class. The child class will inherit all the public and protected properties and methods from the parent class. In addition, it can have its own properties and methods. } Methods () { Polymorphism is the capability of a method to do different things based on the object that it is acting upon. In other words, polymorphism allows you define one interface and have multiple implementations. } Object in English Grammar () { In grammar, an object is a noun, pronoun, or noun phrase on which a verb performs an action. It falls at the end of a sentence, and is governed by a verb or a preposition. } Objects () { An object, in object-oriented programming (OOP), is an abstract data type created by a developer. It can include multiple properties and methods and may even contain other objects. In most programming languages, objects are defined as classes.Feb 28, 2019 } Polymorphism () { Polymorphism is the provision of a single interface to entities of different types or the use of a single symbol to represent multiple different types. Advantages of Polymorphism Programmers code can be reused via Polymorphism. Supports a single variable name for multiple data types. Reduces coupling between different functionalities. } Variable () { A polymorphic Variable is a variable that can reference more than one type of object. Polymorphic variables derive their power from interaction with inheritance, overriding and substituion. A common polymorphic variable is the implicit variable that maintains the reciever during the execution of a method. }