#### Archived

This topic is now archived and is closed to further replies.

# How can i use a global function in a class?

## Recommended Posts

wah_on_2    122
How can i use a global function in a class? And how can i use function pointer to point a global function in a class? Thanks

##### Share on other sites
Dark Star    100
What do u mean a global function, do u mean one defined in another class or part of the program away from ur code. If u mean a function defined in your class then u just give the name for example

suppose the class Test exists

  void Test::function (){    // call another function in my class Test    Test::function2();    // or call it by this    function2();    // or by ''this''    this->function2();}

has for pointers to functions I cannot really remember how to do that

Hope I have helped in anyway

calling a function from another class or ur main program with your function, I dont really know how try calling it the normal way by including the header of the source file it exists in

Dark Star
UK