Re: [Dev-C++] using classes in seprate files
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: <or...@vp...> - 2004-04-14 20:00:13
|
faramarz yari wrote: > hi anybody > i have a problem to using seprate c++ classes. > i have write a class "Search.cpp",it has two function in it. > it has not any main function. > now i want to write another file for example test_search > i want to instantiate an object from Search class in it and use it's=20 > function there. > i wrote: > Search s; > s.linear(); > but i can not use class Search in it because compiler does not know it. > what should i do? You need to put the definition of the class into a header file, and put=20 only the implementation into the .cpp file. Attached is a very small=20 demo on how to do it. -- Greetings, Bal=E1zs |