Last active
September 8, 2017 13:57
-
-
Save kaworu/7d90b0e13a10046be85571d0802017d8 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 <iostream> | |
class Rack { | |
public: | |
Rack(int i): m_i(i) | |
{ } | |
int geti() | |
{ | |
return m_i; | |
} | |
protected: | |
int m_i; | |
}; | |
int | |
main(int argc, char **argv) | |
{ | |
Rack one(1); | |
Rack answer(42); | |
Rack vegeta(9001); | |
Rack *list[] = {&one, &answer, &vegeta}; | |
for (int i = 0; i < (sizeof(list) / sizeof(*list)); i++) | |
std::cout << list[i]->geti() << std::endl; | |
return (0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment