Added: C++ projects

This commit is contained in:
2026-09-29 22:09:02 +02:00
parent 11929bad68
commit 0af79b3686
32 changed files with 1397 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
//
// Created by David Hackbarth on 23.09.26.
//
#ifndef CLASSES_WEAPON_H
#define CLASSES_WEAPON_H
class Weapon {
public:
// implicit inlining
const int& getAmmo() const { return _ammo; }
void setAmmo(int ammo) { _ammo = ammo; }
// explicit inlining
const int& getDamage() const;
void setDamage(int damage);
private:
int _ammo = 0;
int _damage = 0;
};
// explicit inlining needs the method definition to be always in the header file
inline const int& Weapon::getDamage() const { return _damage; }
inline void Weapon::setDamage(int damage) { _damage = damage; }
#endif //CLASSES_WEAPON_H