As per the MSDN doc on __interface, a Visual C++ interface "Cannot contain constructors, destructors, or operators."
Why can't an interface contain an operator? Is there that much of a difference between a get method that returns a reference:
SomeType& Get(WORD wIndex);
and the overloaded indexer operator?
SomeType& operator[](WORD wIndex);
The __interface
modifier is a Visual C++ extension to help implementing COM interfaces. This allows you to specify a COM 'interface' and enforces the COM interface rules.
And because COM is a C compatible definition, you cannot have operators, Ctor or Dtors.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With