Skip to content

Instantly share code, notes, and snippets.

@iggyvolz
Created September 6, 2018 03:51
Show Gist options
  • Save iggyvolz/ef7ad6bc90bfc5919bc1be9ddfb12c10 to your computer and use it in GitHub Desktop.
Save iggyvolz/ef7ad6bc90bfc5919bc1be9ddfb12c10 to your computer and use it in GitHub Desktop.
#include <cstdlib>
#include<iostream>
class x
{
public:
static void y();
static void z();
static void q();
};
void x::y(){
std::cout << "You're in Y!" << std::endl;
}
void x::z(){
std::cout << "You're in Z!" << std::endl;
}
void x::q(){
std::cout << "You're in Q!" << std::endl;
}
int main()
{
void (*func[])() = {x::y,x::z,x::q}; // Except I don't want to retype all my functions here
for(std::size_t i=0;i<3;i++)
{
func[i]();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment