Created
September 6, 2018 03:51
-
-
Save iggyvolz/ef7ad6bc90bfc5919bc1be9ddfb12c10 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 <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