C++

Header files (.h / .hpp)

Në shqip: Skedarët header

ShpjegimiSQ

Në C++ kodi zakonisht ndahet në dy skedarë: header-i (.h) që thotë çfarë ekziston — klasat dhe prototipet e funksioneve — dhe .cpp-ja që e ka kodin e plotë. #pragma once në krye të header-it e pengon të përfshihet dy herë.

EnglishEN

In C++ code is usually split into two files: the header (.h) saying what exists — classes and function prototypes — and the .cpp with the full code. #pragma once at the top of a header stops it being included twice.

Si ta mendosh

Header-i është si tabela e përmbajtjes së librit; .cpp-ja janë vetë kapitujt.

Lexoje në anglisht

The header is like a book's table of contents; the .cpp files are the chapters themselves.

Shembull kodicpp

// loja.h
#pragma once
int piket(int gola);

// loja.cpp → int piket(int gola) { return gola * 3; }

Terma të lidhur