#include#include #include #include class QuestLogEntry { public: int GetMobCount() const { return mobCount_; } private: int mobCount_ = 0; }; int main() { QuestLogEntry quest; quest.GetMobCount(); // returns 0 quest.mobCount_ = 10; quest.GetMobCount(); // returns 10 return 0; }
#includeThis example includes a QuestLogEntry class inside the Quest namespace with a GetMobCount function that retrieves the number of mobs in the current quest log entry. The function returns the integer value of mobCount_, which starts as 0 but can be set to any integer value. This example belongs to the Quest package library.#include #include #include #include #include namespace Quest { class LogEntry { public: int GetMobCount() const { return mobCount_; } private: int mobCount_ = 0; }; } int main() { Quest::LogEntry quest; quest.GetMobCount(); // returns 0 quest.mobCount_ = 20; quest.GetMobCount(); // returns 20 return 0; }