Object-oriented programming (OOP) allows data and functionality to be packaged together into reusable and modular units called classes. A class acts as a blueprint for creating objects that encapsulate data and functions. The four pillars of OOP are encapsulation, abstraction, inheritance, and polymorphism which allow code to be organized, reused, and flexible.