Created
June 29, 2017 05:24
-
-
Save MizukiSonoko/25bfcf4f53c6bdfed8c1e1e6dad0ad43 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
#include <string> | |
#include <sstream> | |
#include <iostream> | |
#include <memory> | |
#include <string.h> | |
#include <cstdarg> | |
#include <type_traits> | |
using namespace std; | |
class VoiceActress{ | |
public: | |
virtual void greeting() = 0; | |
virtual ~VoiceActress()=default; | |
}; | |
class Naobou : public VoiceActress{ | |
public: | |
void greeting(){ | |
cout << "I'm nao!" << endl; | |
} | |
}; | |
class Kayanon : public VoiceActress{ | |
public: | |
void greeting(){ | |
cout << "I'm kayanon!" << endl; | |
} | |
}; | |
class Nanasan : public VoiceActress{ | |
public: | |
void greeting(){ | |
cout << "I'm nanasama!" << endl; | |
} | |
}; | |
void greeting(VoiceActress* vc){ | |
vc->greeting(); | |
} | |
int main(){ | |
vector<VoiceActress*> actresses; | |
actresses.push_back(new Naobou()); | |
actresses.push_back(new Nanasan()); | |
actresses.push_back(new Kayanon()); | |
for(auto&& a: actresses){ | |
greeting(a); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment