{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "49e6bc17",
   "metadata": {},
   "source": [
    "```{index} class type; user defined object\n",
    "```\n",
    "\n",
    "(classes)=\n",
    "\n",
    "# Classes\n",
    "\n",
    "<!-- chapter-intro -->\n",
    "\n",
    "Object-oriented programming begins with the class — a blueprint that bundles state and behavior together.\n",
    "This chapter covers the first and most important OOP pillar: **encapsulation** — hiding data inside a class\n",
    "and exposing only what's needed. You'll define classes, create instances, and build reusable types like `Rational`.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e292056e",
   "metadata": {},
   "source": [
    "<h2>Why this chapter matters</h2>\n",
    "\n",
    "**Encapsulation** is the most universally useful OOP principle — every serious C# program uses it.\n",
    "Organizing code around objects that own their data leads to programs that are easier to extend and reason about:\n",
    "\n",
    "- fields store the state an object needs to do its job\n",
    "- methods operate on that state, keeping implementation details private\n",
    "- constructors ensure objects start in a valid configuration\n",
    "- properties provide controlled access to private fields\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2e7c3b89",
   "metadata": {},
   "source": [
    "<h2>Learning goals</h2>\n",
    "\n",
    "By the end of this chapter, you should be able to:\n",
    "\n",
    "- define a class with fields, constructors, methods, and properties\n",
    "- apply encapsulation using `private` fields and `public` properties\n",
    "- create and use instances of your own classes\n",
    "- implement a complete class such as `Rational` with arithmetic operations\n",
    "- distinguish between classes (reference types) and structs (value types)\n",
    "\n",
    "<h2>Chapter flow</h2>\n",
    "\n",
    "```{tableofcontents}\n",
    "```\n"
   ]
  }
 ],
 "metadata": {
  "jupytext": {
   "cell_metadata_filter": "-all",
   "main_language": "python",
   "notebook_metadata_filter": "-all"
  },
  "language_info": {
   "name": "python"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
