SHARE
TWEET

Untitled

a guest May 9th, 2011 90 Never
  1. #include "Function.h"
  2.  
  3. #include <iostream>
  4.  
  5. void HelloWorld(int iterations){
  6.   for(int i = 0; i<iterations; i++){
  7.     std::cout << "Hello, World!" << std::endl;
  8.   }
  9. }
  10.  
  11. class SillyHello {
  12. private:
  13.   const char* name;
  14. public:
  15.   SillyHello(){
  16.     name = "Class Hello World";
  17.   }
  18.   void displaySelf(){
  19.     std::cout << name << std::endl;
  20.   }
  21. };
  22.  
  23. int main(){
  24.   Function<void, int> hello(HelloWorld);
  25.   hello(3);
  26.  
  27.   SillyHello chickenfeet;
  28.   Function<void> helloclass(&chickenfeet, &SillyHello::displaySelf);
  29.   helloclass();
  30.  
  31.   Function<void> doubley = helloclass;
  32.   doubley();
  33.  
  34.   return 0;
  35. }
RAW Paste Data
Top