What is object oriented programming?
Object Oriented Programming or OOP is a type of programming process where you can create things called “objects” that contain data types, and certain functions. For example a car is an object. It can do things like accelerate and brake. These objects can be used in tandem with other objects to create a larger application.
Classes
A Class is a blueprint for an object. A class can be used to make many objects. For example, one ‘car’ class can be used to make many car objects. A class contains attributes(characteristics) and methods(functions). Another example of a class-object relation is that a vegetable class can make many vegetable objects such as carrots, spinach, corn, etc. Vegetables have many common attributes such as having roots, leaves, and stems.
Methods
Methods are used for a class to perform an action. A method has to be declared inside a class because methods belong to classes. For example a ‘human’ class might have methods inside of them named ‘walk’ and ‘run’ that tell an object how the ‘human’ class walks or runs.
Constructor
A constructor. initializes an object's state when it is first created.. Constructors have the same name as the class that it is from. Usually a constructor is used to pass initial data into an object. Constructors are usually built to create parameters for an object that is based off of a class.