csripriya1
Programmer
Hi I am having trouble in programming using multiple files in C++.
I have a class declaration in a header file like this.
class test
{
private:
data;
public:
void testfunc();
}
I included this header in a source file, which gives the definition for those functions in the class in header file.
#include "blahblah.h"
void test::testfunc()
{
.......
}
I am calling a function of this class from main . So, I included this header file in main too.
#include <iostream.h>
#include "blahblah.h"
void main()
{
test justfortest;
.............
justfortest.testfunc();
}
When I am trying to compile this , compiler complains about the functions being declared twice.can anyone pl help me with this.
Thanks for your time.
I posted this in unix forum too.am sorry for that
I have a class declaration in a header file like this.
class test
{
private:
data;
public:
void testfunc();
}
I included this header in a source file, which gives the definition for those functions in the class in header file.
#include "blahblah.h"
void test::testfunc()
{
.......
}
I am calling a function of this class from main . So, I included this header file in main too.
#include <iostream.h>
#include "blahblah.h"
void main()
{
test justfortest;
.............
justfortest.testfunc();
}
When I am trying to compile this , compiler complains about the functions being declared twice.can anyone pl help me with this.
Thanks for your time.
I posted this in unix forum too.am sorry for that