I’m having a heck of a time understanding C++/CLI syntax. I have a member variable defined as so:
gcroot<Object^> m_DotNetContextFactory;
I’d like to cast this object to an IContextFactory interface.
If I were in C#, I would simply do the following:
object contextFactory = ...;
IContextFactory contextFactory = (IContextFactory)contextFactory;
Any ideas?
A double cast is required since you rooted Object^. I assume that’s the problem here. For example:
Or make it a bit more readable with a helper variable: