Created
February 14, 2023 04:50
-
-
Save prestonvasquez/e660195f8417de03446330d2a0b68bfe 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> | |
#include <type_traits> | |
using namespace std; | |
// Derived classes | |
class Human { | |
public: | |
static int getMove() { | |
// TODO: add logic | |
return 1; | |
} | |
}; | |
class Computer { | |
public: | |
static int getMove() { | |
// TODO: add logic | |
return 0; | |
} | |
}; | |
template <typename F> | |
int battle(F p1, F p2) { | |
return p1() + p2(); | |
} | |
int main(void) { | |
Human p1; | |
Computer p2; | |
cout << "value: " << battle(p1.getMove, p2.getMove) << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment