Weird error implementing a interface

hi

i'm trying to implement a interface in c++ using visual studio 2012.
but i'm getting a weird error, the code does compile but it also gives me this error.

IntelliSense: declaration is incompatible with "void Child::OverrideMe()" (declared at line 17)
IntelliSense: explicit type is missing ('int' assumed)


so i was wondering why.

i have 2 code samples one that works and one that does not.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
class IDemo
{
    public:
        virtual ~IDemo() {}
        virtual void OverrideMe() = 0;
};

class Parent
{
    public:
        virtual ~Parent();
};

class Child : public Parent, public IDemo
{
    public:
        virtual void OverrideMe()
        {
            //do stuff
        }
};


this works but i don't want to do stuff in my header file.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class Parent
{
    public:
        virtual ~Parent();
};

class IDemo
{
    public:
        virtual ~IDemo() {}
        virtual void OverrideMe() = 0;
};

class Child : public Parent, public IDemo
{
    public:
        virtual void OverrideMe();
};

Child::OverrideMe(void)
{

};


and this does not work and i have no idea why

Edit:
ok i seem to have fixed it, but why did it give me that error? i just put void in front of the function

1
2
3
4
void Child::OverrideMe()
{

};
Last edited on
Should be

1
2
3
4
void Child::OverrideMe()
{

};
thanks Vlad

i failed big time, c++ i confusing sometimes. but why did it compile even though it gave me the errors?
In my opinion it is a bug of the compiler. Though it decided that int will be assumed (explicit type is missing ('int' assumed)) it shall not compile the function because a qualified name is used.
hmm ok thanks. at least i can continue. thumbs up for your help :}
Topic archived. No new replies allowed.