Table of Contents Introduction: Templates Procedural vs. Object-Oriented Programming Procedural Programming Object-Oriented Programming Objects and Classes Objects Classes Features of Object-Oriented Programming: Encapsulation, Inheritance, Polymorphism Encapsulation Inheritance Polymorphism 1. Intr...
Classes and Objects Class Fundamentals A class serves as a blueprint defining common attributes and behaviors for a group of related objects. A object is a concrete instance created from that blueprint. In Java, the development workflow typically follows this pattern: Define the class structure firs...
Encapsulation bundles data and functionality with in a single unit, controlling access to internal states. In Python, this is achieved through classes where attributes and methods are categorized by their scope and visibility. Access modifiers distinguish between public members, accessible anywhere,...
Initialization Lists Overview Class constructors can initialize member variables through assignment within the function body, but another method is using initialization lists. An initialization list begins with a colon followed by a comma-separated list of member variables, each followed by an initi...
Object-Oriented Fundamentals Object-oriented programming revolves around creating blueprints called classes that define the structure and behavior of objects. A class serves as a template for instantiating individual objects, each with its own distinct state. Key components of a class definition: Co...
After covering destructors in a previous note, this antry continues with two essential default member functions: copy constructors and operator overloading. Copy Constructor A copy constructor is a special constructor whose first parameter is a reference to the same class type, and any additional pa...
Core Concepts TypeScript leverages classes and interfaces to enforce type safety while supporting object-oriented design. Classes provide concrete implementations, whereas interfaces define structural contracts without implementation. class Employee { name: string; department: string; constructor(na...