when you write code in the main function if you put functions in the file all you do is nameoffunction(); to call it. now my question is this lets say you have a menu in a class. call it bank. in the main to call that function . ive tried calling it the same way but that wont work because function isnt in main file. i thought that if you declared a class object .. bank account; then account.nameofFunction(); it would call it but it says there is a link error .. how do i call a function holding a menu from my main is actually my question ive gotten myself lost
buckeyemike 0 Newbie Poster
Recommended Answers
Jump to PostYou almost certainly don't need to make anything a friend of anything else to do whatever it is that you're trying to do. Post the code that you have so far and we can have a better look at it...
Jump to PostIn C++, every cpp file is compiled separately, and then linked together. When the functions appear in the same cpp file as the
main()
function, then it is compiled together and doesn't need linking. When the functions appear in a different cpp file, then all the compiled cpp files …
All 5 Replies
triumphost 120 Posting Whiz
tinstaafl 1,176 Posting Maven
buckeyemike 0 Newbie Poster
ravenous 266 Posting Pro in Training
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.