How can i use a global function in a class?

Started by
1 comment, last by wah_on_2 21 years, 11 months ago
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
Advertisement
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
---------------------------------------------You Only Live Once - Don't be afriad to take chances.
Global functions can be called from everywhere, you just need to include the file where the prototype is defined
"THE INFORMATION CONTAINED IN THIS REPORT IS CLASSIFIED; DO NOT GO TO FOX NEWS TO READ OR OBTAIN A COPY." , the pentagon

This topic is closed to new replies.

Advertisement