Python

Class

Në shqip: Klasë

ShpjegimiSQ

Klasa është një shabllon për të krijuar objekte që kanë të njëjtat veti dhe veprime. E shkruan një herë klasën „Student“ dhe pastaj krijon sa studentë të duash prej saj.

EnglishEN

A class is a template for creating objects that share the same properties and actions. You write a “Student” class once, then create as many students from it as you like.

Si ta mendosh

Si kallëpi i biskotave: kallëpi është një, por me të bën shumë biskota — secila mund të ketë zbukurim tjetër.

Lexoje në anglisht

Like a cookie cutter: there's one cutter, but you make lots of cookies with it — each can be decorated differently.

Shembull kodipython

class Student:
    def __init__(self, emri):
        self.emri = emri
arta = Student("Arta")
print(arta.emri)  # Arta

Terma të lidhur