Please enable JavaScript.
Coggle requires JavaScript to display documents.
OOP - Coggle Diagram
OOP
Inheritance - sub class takes on attributes and methods from superclass, can also have its own extra attributes and methods
Polymorphism
Overriding - when a method name is same in parent and sub class the method in the superclass will be overridden
-
Overloading - allows multiple methods that require different parameters to use the same name. For example, you may want to make some values optional when instantiating an object
E.g Cat class
public procedure new (age)
this.age=age
this.legs=4
public procedure new (age, legs)
this.age=age
this.legs=legs
mia = new Cat(6)
percy = new Cat(12, 3) //Both ‘new’ methods can be called
-
-
Encapsulation - protects attributes by making them private, cant be accessed/altered by other objects
-
Objects - instance of class, share same attributes and methods
OOP allows for code reusability, class can be saved as a library and reused many times