Re: compilation error... Am I missing anything?
* smilesonisamal@gmail.com:
class A
{
public:
void SetA(EmployeeCategory a); // EmployeeCategory is a enum
and is already declared.
I wonder what made you decide that that declaration could be totally irrelevant?
EmployeeCategory GetA() const;
private :
EmployeeCategory m_emplCategory; // This is initialized in the
constructor
}
In .cpp file
--------------
EmployeeCategory A::GetA() const
{
return m_emplCategory;
}
Set function works fine. But when I try to return a value for enum I
get the following error:
error C2511: ' EmployeeCategory A::GetA() const' : overloaded member
function not found in 'A'
I dont understand why this problem comes.
Because at that point you don't have anything named EmployeeCategory.
The following code works:
No it does not.
A: GetA(EmployeeCategory *eCat)
Here you have a syntax error, hence the code cannot "work" in any sense.
{
*eCat = m_emplCategory;
}
Is this a bug in the Visual Studio or I am missing anything?
The latter.
A few times. :-)
Summing up: you have decided to (A) *not* provide the relevant information for
your problem, namely the declaration of EmployeeCategory (but all right, we old
hands understand from the problem that it's within the class or a base class,
but you could not know that we'd be familiar with your problem) and you have
decided to (B) instead provide some *incorrect*, misleading information, which
is very very counter-productive: it simply doesn't make sense to try to send
those you ask for help, on a wild goose chase.
Is that intentional, or?
If it's not intentional, then please read the FAQ's guidelines on how to post
(Google for "C++ FAQ Lite").
Cheers & hth.,
- Alf
--
Due to hosting requirements I need visits to <url: http://alfps.izfree.com/>.
No ads, and there is some C++ stuff! :-) Just going there is good. Linking
to it is even better! Thanks in advance!