Class

A

anonymous

I have a function get with 3 parameters
Get(par1,par2,par3).
This function is called i main:
main
{....
Get(par1,par2,par3);
....}
I would like to put this function in class.
Class
{Public:
Get(par1,par2,par3)
{....};
}
But now when I call this function:Get(par1,par2,par3);
I get the following error:undeclared identifier
What am I doing incorrect?
 
J

Jackson Davis [MSFT]

-----Original Message-----
I have a function get with 3 parameters
Get(par1,par2,par3).
This function is called i main:
main
{....
Get(par1,par2,par3);
....}
I would like to put this function in class.
Class
{Public:
Get(par1,par2,par3)
{....};
}
But now when I call this function:Get(par1,par2,par3);
I get the following error:undeclared identifier
What am I doing incorrect?

.

There are several problems with the code as you posted it.
First, C/C++ is case sensitive, and the keyword you are
using should be "class" all lowercase.
Second, your class definition needs a semi-colon at the
end, third, you should specify a return value, fourth, you
need to give your class a name, and finally, you need to
call it from an instance. So your code would look
something like:

class MyClass
{
public:
void Get(par1,par2,par3)
{....};
};


void main()
{
MyClass myInstance;
myInstance.Get(par1,par2,par3);
}

Hope that helps

Jackson Davis [MSFT]
--
This posting is provided "AS IS" with no warranties, and
confers no rights.
Use of included script samples are subject to the terms
specified at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all
responses to this
message are best directed to the newsgroup/thread from
which they
originated.
--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top