You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using C++/WinRT, and I'd like to make a class ("ClassB") instantiable only through another class ("ClassA"). I've already removed the default constructor from the Class B .idl declaration.
It seems that the general C++ approach to this is to make the constructor of ClassB private, and then to make ClassA a friend struct of ClassB. But it doesn't seem that be that straightforward in C++/WinRT, given the complex implementation class hierarchy and projection setup. I'll get this compiler error:
'winrt::impl::heap_implements<T>::heap_implements(void)': attempting to reference a deleted function
Or in other words, is there a way to make the call to winrt::make<implementation::ClassA>()exclusive to Class B?
Does anyone know how to do this? Thanks for any info.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using C++/WinRT, and I'd like to make a class ("ClassB") instantiable only through another class ("ClassA"). I've already removed the default constructor from the Class B .idl declaration.
It seems that the general C++ approach to this is to make the constructor of ClassB private, and then to make ClassA a
friend structof ClassB. But it doesn't seem that be that straightforward in C++/WinRT, given the complex implementation class hierarchy and projection setup. I'll get this compiler error:'winrt::impl::heap_implements<T>::heap_implements(void)': attempting to reference a deleted functionOr in other words, is there a way to make the call to
winrt::make<implementation::ClassA>()exclusive to Class B?Does anyone know how to do this? Thanks for any info.
Beta Was this translation helpful? Give feedback.
All reactions