I have a class with a method which should return the object itself, like doing return this; in Java. I tried something like this:
Foo.h:
namespace Foo {
public ref class Bar {
public:
Bar quux();
}
}
Foo.cpp:
Foo::Bar Foo::Bar::quux() {
return this;
}
The compiler complains: error C2440: 'return' : cannot convert from 'Foo:Bar ^const ' to 'Foo::Bar'
How do I get this right?
You should write the following way