Please enable JavaScript.
Coggle requires JavaScript to display documents.
Object Oriented Programming - Coggle Diagram
Object Oriented Programming
Inheritance
Parent class is also known as a a superclass and a child class is also known as a subclass.
Inheritance makes it possible to create child classes that inherit the attributes and methods from the parent class.
What is object oriented programming?
OOP is a programming paradigm, this is meant by an overall approach to writing program code.
We use object oriented programming because it allows code to be reused instead of using new code to complete a task.
Different parts of a class:
Attribute:
An attribute is a variable that is shared between all the objects of this class and it is defined outside the constructor function
Class name:
A class name is used to name the class so that we can call the class throughout the program.
Method:
A method defines the behavior of the objects that are created from the class. Another way to say this is that a method is an action that an object is able to perform.
What is a class?
An extensible program-code-template for creating objects.
A class is a blueprint that defines the variables and the methods common to all objects of a certain kind.
Polymorphism
Polymorphism is a useful technique that allows a subclass to redefine properties or methods inherited from the parent class.
It is extremely useful if the inherited method is not completely appropriate for its function.
Encapsulation
Encapsulation involves keeping data and methods together in the same unit.
Essentially it bundles them together.
This keeps it safe from outside interference.
A class is an example of encapsulation
Relationships
Association - Defines a relationship between classes of objects that allows one object instance to cause another to perform an action on its behalf.
Aggregation - Is a specialised form of association, it defines a one-way relationship that specifies a 'has-a' relationship between two classes.
Composition - It describes a class that references one or more objects of other classes in instance variables. This allows you to model a ‘has-a’ association between objects.
Instance
An instance, in object-oriented programming (OOP), is a specific realization of any object.