Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
override
//g++ 5.4.0 #include <iostream> using std::cout; using std::string; class Human{ string name; public: Human(const char* name):name(name){}; virtual void say(); }; class Taiwanese : public Human{ public: Taiwanese(const char* name):Human(name){} void say() override; }; class Japanese : public Human{ public: Japanese(const char* name):Human(name){} void say() override; }; class American : public Human{ public: American(const char* name):Human(name){} void say() override; }; void Human::say(){ cout<< name <<':'; } void Taiwanese::say(){ Human::say(); cout<< "你好\n"; } void Japanese::say(){ Human::say(); cout<< "こにちは\n"; } void American::say(){ Human::say(); cout<< "Hello\n"; } int main() { Human* man1 = new Taiwanese("阿硯"); Human* man2 = new Japanese("クロ"); Human* man3 = new American("Leo"); man1->say(); man2->say(); man3->say(); return 0; }
run
|
edit
|
history
|
help
0
Привет Linux
Example of range-base for loop
https://codeforces.com/contest/449/problem/D (INCLuSION EXCLUSION principle)
RegTokIt
Вариант универсального указателя.
fb_series
QuickDoubly
MyList
პირამიდის პერიმეტრი.ფინალური
e-olymp.com---problem1590---Birthday 2