{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "51647b8f",
   "metadata": {},
   "source": [
    "# 14-05 · self i metody łączenia\n",
    "\n",
    "Praktyka do sekcji [„self i metody linkowania”"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bc23c59a",
   "metadata": {},
   "source": [
    "## Cel\n",
    "\n",
    "Zobaczyć, że obj.method() i Class.method(obj) — to to samo wywołanie."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2b3f13b8",
   "metadata": {},
   "source": [
    "## Sprawa robocza"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "584d6405",
   "metadata": {},
   "outputs": [],
   "source": [
    "class Sobaka:\n",
    "    def __init__(self, klichka):\n",
    "        self.klichka = klichka\n",
    "\n",
    "    def layat(self):\n",
    "        return f\"{self.klichka}: Гав-гав!\"\n",
    "\n",
    "rex = Sobaka(\"Рекс\")\n",
    "print(rex.layat())\n",
    "print(Sobaka.layat(rex))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "03e9333a",
   "metadata": {},
   "source": [
    "## Podstawowa praktyka zadań ★\n",
    "\n",
    "Utwórz klasę `Kot` z `klichka` i metoda `myaukat()`który zwraca strunę typu „Barsik: Meow!”"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "313543f7",
   "metadata": {},
   "outputs": [],
   "source": [
    "class Kot:\n",
    "    def __init__(self, klichka):\n",
    "        self.klichka = klichka\n",
    "\n",
    "    def myaukat(self):\n",
    "        return f\"{self.klichka}: Мяу!\"\n",
    "\n",
    "kot = Kot(\"Барсик\")\n",
    "print(kot.myaukat())\n",
    "print(Kot.myaukat(kot))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Cartesian Python 3.14",
   "language": "python",
   "name": "cartesian-python314"
  },
  "language_info": {
   "name": "python",
   "version": "3.14.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
