one implementation of the exam
This commit is contained in:
71
cpp_module_02/Warlock.hpp
Normal file
71
cpp_module_02/Warlock.hpp
Normal file
@@ -0,0 +1,71 @@
|
||||
#ifndef WARLOCK_HPP
|
||||
# define WARLOCK_HPP
|
||||
|
||||
# include <iostream>
|
||||
# include <string>
|
||||
# include "ASpell.hpp"
|
||||
# include "ATarget.hpp"
|
||||
# include "SpellBook.hpp"
|
||||
|
||||
class Warlock {
|
||||
private:
|
||||
Warlock();
|
||||
Warlock(Warlock const & other);
|
||||
Warlock & operator=(Warlock const & other);
|
||||
|
||||
std::string name;
|
||||
std::string title;
|
||||
SpellBook book;
|
||||
|
||||
public:
|
||||
Warlock(std::string const & name, std::string const & title)
|
||||
{
|
||||
this->name = name;
|
||||
this->title = title;
|
||||
std::cout << this->name << ": This looks like another boring day.\n";
|
||||
};
|
||||
~Warlock()
|
||||
{
|
||||
std::cout << this->name << ": My job here is done!\n";
|
||||
};
|
||||
|
||||
std::string const & getName() const
|
||||
{
|
||||
return (this->name);
|
||||
};
|
||||
std::string const & getTitle() const
|
||||
{
|
||||
return (this->title);
|
||||
};
|
||||
|
||||
void setTitle(std::string const & title)
|
||||
{
|
||||
this->title = title;
|
||||
};
|
||||
|
||||
void introduce() const
|
||||
{
|
||||
std::cout << this->name << ": I am " << this->name << ", " << this->title << "!\n";
|
||||
};
|
||||
|
||||
void learnSpell(ASpell *aspell)
|
||||
{
|
||||
book.learnSpell(aspell);
|
||||
};
|
||||
void forgetSpell(std::string name)
|
||||
{
|
||||
book.forgetSpell(name);
|
||||
};
|
||||
void launchSpell(std::string name, ATarget const & atarget)
|
||||
{
|
||||
//ATarget const * test = 0;
|
||||
//if (test == & atarget)
|
||||
// return;
|
||||
|
||||
ASpell * spell = book.createSpell(name);
|
||||
if (spell)
|
||||
spell->launch(atarget);
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user