Object Oriented Programming

The basic terms of object oriented programming, explained clearly for beginners.

Last updated: September 1, 2026

Basic terms

ClassA blueprint that describes which properties and abilities something has
ObjectA concrete instance of a class, created from its blueprint
AttributeA property of an object, like name or age
MethodA function that belongs to a class and lets objects do something
ConstructorA special method that runs when an object is created

The four core principles

EncapsulationHiding an object's internal details from the outside, only accessible through methods
InheritanceA class takes on properties and methods of another class
PolymorphismDifferent classes react differently to the same method call
AbstractionOnly showing the important details, unimportant details are hidden

Example in Java

class Car { }Defines a new class called Car
private String color;A private attribute, only directly accessible within the class
public Car(String color) { ... }The constructor, sets the color when created
new Car("Red");Creates a new object of the class Car

More terms

InterfaceDictates which methods a class must have, without implementing them itself
Inheritance hierarchyThe chain of parent and child classes that pass properties down
thisRefers within a class to the current object itself
Worth a look

Inheritance between classes

A subclass automatically inherits attributes and methods from its parent class.

Vehicle (parent class)
Car
Motorcycle

Car and Motorcycle inherit from Vehicle, but can additionally have their own methods.