Classes and Object Orientated Programming
A class is like a blueprint or template for creating objects that have attributes (data) and can execute methods
Example Player Class:
Called Player
Each actual character you spawn is an object
Each player has attributes (names) and methods (attack, speak)
KEY INFO:
Class - a blueprint
Object - is an instance of a class
Attribute - A variable stored in an object
Method - a function defined inside a class
Constructor - special method that sets up attribute values when an object is created or a method called when creating an instance
Encapsulation is the method of hiding the attributes of an object and allowing it to be accessed or changed through public methods like getters or setters
Prevents accidental changes, keeps data and methods together and protects data from direct external access
Inheritance allows a class to to inherit attributes and methods from another class the parent class
Reuse code from a more general class and extend behaviour with new feature
Polymorphism means methods behave differently depending on the object that calls usually through method overriding
Same method name different behaviour