/
rgd045
/
cpp-oop-basics
Обзор
Документация
Войти
/
rgd045
/
cpp-oop-basics
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
projects/spells/spell.cpp
34 строки
931 B
OMP Education
Add modules
28 июн 2024, 01:09
28 июн 2024, 01:09
0ef3df8
Код
Авторство
О чём код?
// SPDX-FileCopyrightText: 2023 Open Mobile Platform LLC <edu@omp.ru> // SPDX-License-Identifier: BSD-3-Clause #include "spell.h" Spell::Spell(std::string name) { m_name = name; }; Spell::Spell(std::string name, int cost, float castingTime): m_name{name}, m_cost{cost}{ }; Spell::Spell(std::string name, int cost, float castingTime, int damage){ m_name = name; m_cost = cost; m_castingTime = castingTime; m_minDamage = m_maxDamage = damage; } Spell::Spell(std::string name, int cost, float castingTime, int minDamage, int maxDamage){ m_name = name; m_cost = cost; m_castingTime = castingTime; m_minDamage = minDamage; m_maxDamage = maxDamage; } void Spell::cast() { std::cout << "Casting a spell of '" << m_name << "' on yourself!" << std::endl; } void Spell::cast(std::string enemy) { std::cout << "Casting a spell of '" << m_name << "' on '" << enemy << "'!"<< std::endl; }