Class img
{
public:
enum DIRECTION {TO_ZERO, TO_INFINITY};
};
//in main
img ball;
//VC++ says it's not standard and gives a warning.
ball.setDirectionY(Sprite::DIRECTION::TO_INFINITY);
Is this non-standard?
Consider this class:
How can I make so I don't get the warning?
Have a look here on how to use enums inside classes:
http://msdn.microsoft.com/en-us/library/2dzy4k6e(VS.71).aspx
http://msdn.microsoft.com/en-us/library/2dzy4k6e(VS.71).aspx
Quote:Original post by Dave
What is the exact warning
warning C4482: nonstandard extension used: enum 'Sprite::DIRECTION' used in qualified name
Quote:Original post by Dave
Have yo googled for that error code?
Just now :)
// C4482.cpp// compile with: /c /W1struct S { enum E { a };};int i = S::E::a; // C4482int j = S::a; // OK
Thanks!
When posing code please post valid code not code which you have just made up. You are using a class/namespace name Sprite yet the enumeration is in the namespace img. To use in the current standard you would use
IIRC the next standard changes this and requires the enum tag to allow for enumeration values in the same namespace(not enum namespace) yet different enum namespace to have the same name.
for example
struct Foo
{
enum bar{something};
enum baz{something};
};
[/source]
img::TO_ZERO
IIRC the next standard changes this and requires the enum tag to allow for enumeration values in the same namespace(not enum namespace) yet different enum namespace to have the same name.
for example
struct Foo
{
enum bar{something};
enum baz{something};
};
[/source]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement