English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

it is said that the main method or any method you have in your program calls arther methods.so i do'nt understand how the arther method will call another .

2006-08-26 10:23:08 · 3 answers · asked by mskbngn 1 in Computers & Internet Programming & Design

3 answers

Its really a lot more simple than the above information:

A method calls another method when there is a method called in it

for example:

int main (args){
foo(args);
}

void foo(bar){
//do stuff with bar, maybe more method calls
}

In this example the method main() calls the method foo().

2006-08-26 12:15:00 · answer #1 · answered by John J 6 · 0 0

If you realy need to know the internal operations of the compiler, read some compiler specific books. If you need to understand the "concept" of "calling", is just a simple set of instructions encapsulated into a name... So instead of having a very big file with a lot of lines of code, the compiler "geeks" have developed a way to put a code into a special construction called "method" and to assign the whole code you put here with a name...(it's more complex than this but I'm not going into detalils right now...). By the way if you will read enough you will find out that at the compilation time, the "name" of the method is practically "replaced" by the code contained in it...As far as calling from one method another method... is basically the same concept described above... the compiler must "find" the "name" of the method in order to replace it at the compilation time with the appropriate code...

It's late and I hope I've made miself "understandable"...:)).

2006-08-26 10:42:58 · answer #2 · answered by None A 3 · 0 0

the best example:
suppose we have method
char read(){
char c = 'C';
}
and another method
char printOut(){
Printf("call the read method ",%cread());
}
here we can say that we are calling read() method in the mathod printOut which gives o/p:
call the read method C


lol..
i think it'll help you..

2006-08-26 10:31:37 · answer #3 · answered by binni 2 · 0 0

fedest.com, questions and answers