Visual C++ Dilemna

I am trying to create a simple class in VC++ 6.0, professional edition.  The following is the class definition:

#if !defined(AFX_QUERY2_H__0A2EA640_C2A8_11D3_AC4E_0004AC3504ED__INCLUDED_)
#define AFX_QUERY2_H__0A2EA640_C2A8_11D3_AC4E_0004AC3504ED__INCLUDED_

#include <string>
#include <iostream>
#include <vector>

class Query2  
{
public:
      Query2(){};
      Query2(string s){};      
      virtual ~Query2(){};
};

#endif

I am getting the following two errors on the second constructor (and on any other constructor that I add, manually or using the built in "Add Member Function" tool):

c:\kbs code\kbs general\kbs_sqlquery1\query2.h(18) : error C2629: unexpected 'class Query2 ('
c:\kbs code\kbs general\kbs_sqlquery1\query2.h(18) : error C2334: unexpected token(s) preceding '{'; skipping apparent
function body

Any thoughts as to what is causing this problem?  Is it syntax or project settings?

Thanks.
LVL 3
Laminamia063099Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jhanceCommented:
It should be:

class Query2  
{
public:
Query2();
Query2(string s);
virtual ~Query2();
};


Then in your Query2.cpp file:

Quert2::Query2()
{
etc.
}

Query2::Query2(string s)
{
etc.
}

Query2::~Query2()
{
etc.
}
0
arikkaCommented:
Add  the next line after include block
using namespace std;

So it must be:

#include <string>
#include <iostream>
#include <vector>

using namespace std;


class Query2  
{
public:
Query2(){};
Query2(string s){};
virtual ~Query2(){};
};


0
jhanceCommented:
After looking at your code some more, I take my answer back.  There is nothing wrong with:

class Query2  
{
public:
Query2(){};
Query2(string s){};
virtual ~Query2(){};
};


as you have it posted here EXCEPT the line:

Query2(string s){};




0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Laminamia063099Author Commented:
I see that you've taken back your first answer, jhance, and I thank you for your comments.  However, what do you mean by your comment:
     
     "EXCEPT the line:

                             Query2(string s){};
     ".

Arikka, I will try your suggestion.  I came across the same thought myself, and if it works, I'll tell you to submit an answer.

0
arikkaCommented:
I am trying again. It works I already
chaecked it...

Add  the next line after include block
using namespace std;

So it must be:

#include <string>
#include <iostream>
#include <vector>

using namespace std;


class Query2    
{
public:
Query2(){};
Query2(string s){};
virtual ~Query2(){};
};

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Laminamia063099Author Commented:
Thanks, I'll try it out and grade the answer soon :)

Laminamia
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.