Difference

hi 2 all
i have an simple console based application. my code is as follows
Code:

class Cmyfircls
{
char str[20];
public:
void get_data();
void show_data();
};
Cmyfircls :: get_data()
{
--
--
}

Cmyfircls :: show_data()
{
--
--
}
// now in the main i m declaring
int main()
{
Cmyfircls *obj;
obj=new Cmyfircls();
obj->get_data();
obj->show_data();
return 0;
}

now it is giving me error 'Cmyfircls' : 'class' type redefinition
i have only one class in my application
suggest me the solution.
[688 byte] By [siya_pandya] at [2007-11-19 6:38:21]
# 1 Re: Difference
void Cmyfircls :: get_data()
{
--
--
}

void Cmyfircls :: show_data()
{
--
--
}

Try this. You have not given the return type there. May be thats the problem.
Vinod S at 2007-11-11 0:30:33 >
# 2 Re: Difference
it is still not working
i tried
anyways thanx for the reply
siya_pandya at 2007-11-11 0:31:35 >
# 3 Re: Difference
are you having another application with the same class name??
dwurity at 2007-11-11 0:32:34 >
# 4 Re: Difference
no i have only one class with that name.
siya_pandya at 2007-11-11 0:33:39 >
# 5 Re: Difference
class Cmyfircls
{
char str[20];
public:
void get_data();
void show_data();
}object;

try this out to create the object for the class.
may be this will solve the prob.
pawan_bishnoi at 2007-11-11 0:34:40 >
# 6 Re: Difference
Try again with a default constructor and see
Vinod S at 2007-11-11 0:35:39 >
# 7 Re: Difference
I have tested and it worked for me
dwurity at 2007-11-11 0:36:32 >
# 8 Re: Difference
thanx 2 all who helped me
my problem got solved.
thanx again.
siya_pandya at 2007-11-11 0:37:36 >
# 9 Re: Difference
what u did ... to solve the problem ??
pawan_bishnoi at 2007-11-11 0:38:36 >
# 10 Re: Difference
try this mate

class Cmyfircls
{
char str[20];
public:
Cmyfircls() {}
void get_data();
void show_data();
};
Cmyfircls :: get_data()
{
--
--
}

Cmyfircls :: show_data()
{
--
--
}

// now in main
int main()
{
Cmyfircls obj;
obj.get_data();
obj.show_data();
return 0;
}

i think this will work.
sam
techsam at 2007-11-11 0:39:37 >
# 11 Re: Difference
By mistake i was including same name with cpp file .
whereas i have to include only header file.
siya_pandya at 2007-11-11 0:40:37 >