Any one... Having rich of C++ knowledge n even who know this problem statement answer it plzzz | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Any one... Having rich of C++ knowledge n even who know this problem statement answer it plzzz

when you define a function in one source file and you call that function in another file. In such case, you should declare the function at the top of the file calling the function. can any one give here example for how to access function written in another file...?? we had lotzz of doubt plzz any one explain with simple programs.

30th Mar 2017, 3:31 PM
Anjaneya Karjigi
Anjaneya Karjigi - avatar
3 Answers
+ 1
Assuming you are using classes in a header file to write the functions, here is a simple example. Let's say you have a function called help within a class in a header file. In the main Cpp file, you want to #include "headerfile.h" (headerfile is the name of your file) If your class name is something like myClass, then in the cpp file, you will use dot notation to access those functions in the other file. First, declare a variable for it myClass ex; Now, you can call your help function using this variable like so: ex.help(); The function is now called from the other file. If you have arguments in that help function calling an integer: ex.help(15); I hope this helps!
30th Mar 2017, 5:27 PM
Blake Lynch
Blake Lynch - avatar
0
yup... helped little bit... but nt getting clear concept.๐Ÿ™‡๐Ÿ™‡๐Ÿ™‡
30th Mar 2017, 6:40 PM
Anjaneya Karjigi
Anjaneya Karjigi - avatar
0
give me an example or show me your code you are trying to do this. I will gladly assist
30th Mar 2017, 7:22 PM
Blake Lynch
Blake Lynch - avatar