Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on May 9th, 2011  |  syntax: C++  |  size: 0.61 KB  |  views: 89  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }