Please enable JavaScript.
Coggle requires JavaScript to display documents.
Object-oriented programming (OOP) - Coggle Diagram
Object-oriented programming (OOP)
Objects
An instance of a class.
Attributes
Properties that the object has.
Attributes are usually private. Can not be interacted with directly by the user. Can only be changed using a public method.
Class
The blueprint for an object. It defines the methods and attributes for the object.
Instantiation
The process of making an object from a class definiton.
Reference variable must be assigned to an instantiated object. This is the memory location of the object.
Inheritance and Polymorphism.
Inheritance
A child class inherits the methods and attributes of a parent class
Polymorphism
Encapsulation and data hiding
Encapsulation wraps the attributes and methods in the class definition. Hides the details of the implementation from the user.
Data hiding means that a programmer that defines an object in a class cannot directly access or change an attribute of that object.
Methods
Types of methods
Setter and Getter methods
Setter methods: Used to alter or change an attribute.
Getter methods: Used to return the attributes value.
Constructor
A method used to create a new object in a class.
Characteristics
Procedures that the object can do.
Methods are usually public. Can be interacted with by the user.