I had never heard of this keyword before, accidently stumbed across it while researching DLL stuff. Is it standard C++? Seems like all members are public by default?

Code:

interface I
{
virtual void M() = 0;
};

class C : public I
{
public:
virtual void M() {};
};

02-21-2006

Daved

It is not standard. It is probably a #define for struct.

02-21-2006

Magos

If it were a define for struct you'd get warnings inheriting a 'class' from a 'struct'... (have gotten these before :) ). The keyword appears blue in VC and bold in DevCPP so if not standard it's at least non-official-semi-standard :P

Yup, and they use the actual 'interface' keyword too (hidden behind tons of macros).

02-21-2006

ChaosEngine

Quote:

Originally Posted by Magos

If it were a define for struct you'd get warnings inheriting a 'class' from a 'struct'... (have gotten these before :) ). The keyword appears blue in VC and bold in DevCPP so if not standard it's at least non-official-semi-standard :P

won't compile? I'm afraid I call bull......... There are only 2 differences between classes and structs
1: default access (public in struct, private in class)
2: you can't forward declare a struct as a class or vice versa
i.e.

Code:

class MyClass;

// some code

struct MyClass // causes a redefinition error
{
};

but you can certainly inherit one from the other.

as for the interface "keyword", it's an ms-specific extension that's recognised by visual studio. It was originally added in for COM support.