Re: [Dev-C++] using classes in seprate files
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Per W. <pw...@ia...> - 2004-04-14 18:32:30
|
You should create a file
Search.h
with contents:
#ifndef __SEARCH_H
#define __SEARCH_H
class Search {
...
void linear();
};
#endif
Create a file
Search.cpp
with contents:
#include ...
#include "Search.h"
void Search::linear() {
}
....
Create file
Test.cpp
with contents:
#include ...
#include "Search.h"
int main() {
Search s;
s.linear();
return 0;
}
/Per W
On Wed, 14 Apr 2004, 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
> 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?
> in dev_c++ or borland c++?
> thank u in advanced
>
> _________________________________________________________________
> STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
> http://join.msn.com/?page=features/junkmail
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IBM Linux Tutorials
> Free Linux tutorial presented by Daniel Robbins, President and CEO of
> GenToo technologies. Learn everything from fundamentals to system
> administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|