Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Bug: C++/CLI implement interface uses override

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
xMRi Posted - Oct 12 2016 : 02:14:19 AM
When you implement an interface for C++/CLI VAX creates the virtual function with the keyword override. But this is wrong.

Implementing an interface in C++/CLI doesn't require the keyword override.If it is used you get a compiler error.
2   L A T E S T    R E P L I E S    (Newest First)
xMRi Posted - Oct 14 2016 : 02:37:04 AM
No there is no special interface, that leads me into the errors
Your sample shows it. VS2015 gives me the following error:

1>ReportEngine.cpp(26): warning C4490: 'override': incorrect use of override specifier; 'Reporting::MyClass::f' does not match a base ref class method
1> ReportEngine.cpp(26): note: 'new' or 'override' are only allowed when a matching base method from a ref class exists
1> ReportEngine.cpp(26): note: Matching base method 'Reporting::MyInterface::f' is from an interface class (not a ref class)

ChrisG Posted - Oct 12 2016 : 4:44:44 PM
Using a CLR Console Application project to test, I can see the behavior you are talking about. You say that the use of 'override' causes the compiler to complain, but I'm not sure what scenario would do that exactly. My tests so far have worked. (although I am not an expert at C++/CLI)

Is there a specific interface declaration that will reproduce this issue?

using namespace System;

interface struct MyInterface
{
	void f();
};

ref class MyClass : public MyInterface
{
public:
	virtual void f() override
	{
		Console::WriteLine(L"Hello World");
	}
};

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000