Click here to Skip to main content
15,891,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
lets say i have a class

class code{

public:
function1
function2

};


code::function1(){

statements:
}

code::function2(){
function1();
}

how can I use a function inside the class to another function in the same class?
is there anything to add or just call it like a normal function???
Posted

1 solution

In C++ you can call it normal as you do it. It may differ in other languages!!!

To clearify the call on the same object ("self") often is written:

C++
self->function1();


It is optional, but many people do it, because it is more "Java-style" or like in Objective-C.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900