Ok guys I want your help in my programming assignment.
I have two files, main.cpp and a class file, i.e. mainMemory.h
I have programming struction like this.
1 2 3 4 5 6 7 8 9 10 11 12
main.cpp
#include <iostream>
#include "mainMemory.h"
////******My Function Definition Here************//////////(myFoo())
int main ()
{
mainMemory obj;
obj.doSomething();
}
No when my doSomething function in class is calling the myFoo() function defined in main.cpp it is not working and giving error? How can I call this function in class can anyone tell me?
Because class does not know about this function existence. You can forward declare it in mainMemory.h, but usually the need to call function outside class is indicator of bad program design.