Re: forward declaration of an enumerated type
Hi Ben,
Thank you very much for your pointing out.
I am awfully sorry for this bad reply. I misunderstand the conception
before.
No matter struct and enum types can be forwarded declared. I performed a
test for clarifying my mistake and hope that it helps for this issue.
//=====x.h=============
#pragma once
struct X {int a;};
enum Color{
Red = 0,
Blue = 1,
Green = 2
};
//======y.h==============
#pragma once
struct X;
enum Color;
void print(X& x);
void print(X& x, ENU enu);
//======y.cpp=========
#include "stdafx.h"
#include "X.h"
#include "Y.h"
void print(X& x)
{
printf("%d",x.a);
}
void print(X& x, Color color)
{
printf("X:%d, Color:%d",x.a,color);
}
//=======main.cpp===========
#include "stdafx.h"
#include "X.h"
#include "Y.h"
int main(void)
{
X x;
x.a = 100;
Color color;
color = Color::Green;
print(x);
print(x,color);
return 0;
}
Hi, David, I am sorry for misleading you in my previous bad reply and
sincerely hope that you can see this reply and post back if you have any
other questions or concerns.
Best regards,
Charles Wang
Microsoft Online Community Support
=====================================================
Get notification to my posts through email? Please refer to:
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications
If you are using Outlook Express, please make sure you clear the check box
"Tools/Options/Read: Get 300 headers at a time" to see your reply promptly.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
======================================================
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
======================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================