Added: C++ projects
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user