Skip to content

Instantly share code, notes, and snippets.

@kaworu
Last active September 8, 2017 13:57
Show Gist options
  • Save kaworu/7d90b0e13a10046be85571d0802017d8 to your computer and use it in GitHub Desktop.
Save kaworu/7d90b0e13a10046be85571d0802017d8 to your computer and use it in GitHub Desktop.
#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