C++

Nested classes

Në shqip: Klasat e brendshme

ShpjegimiSQ

Një klasë e brendshme deklarohet brenda një klase tjetër — p.sh. Nyje brenda ListesLidhur. Përdoret kur një klasë ka kuptim vetëm si pjesë e tjetrës, dhe ndihmon ta mbash kodin të organizuar.

EnglishEN

A nested class is declared inside another class — like Node inside LinkedList. It's used when a class only makes sense as part of the other one, and helps keep code organised.

Si ta mendosh

Si dhoma e motorit brenda anijes: ekziston vetëm si pjesë e saj.

Lexoje në anglisht

Like the engine room inside a ship: it only exists as part of it.

Shembull kodicpp

class Lista {
    struct Nyje { int vlera; Nyje* tjetra; };
    Nyje* koka = nullptr;
};

Terma të lidhur