Create an instance of a class from a string
Take a look at the Activator.CreateInstance method.
Take a look at the Activator.CreateInstance method.
I was right about the import.. When i was trying to do: User.UserPK userpk = new User.UserPK(); It was failing because i had an import like this one: org.company.User.UserPK; What I did to solve it it’s let the import like this: org.company.User; It allowed me to instantiate the class as an inner one. Thanks for … Read more
Just make ctor private/protected and provide a static method(s) to create an instance: class HeapOnly { HeapOnly(); HeapOnly( int i ); public: static HeapOnly *create() { return new HeapOnly; } static HeapOnly *create( int i ) { return new HeapOnly( i ); } }; You may consider to return a std::unique_ptr in general case, but … Read more