Hi All,
I would like to know how to implement reflection is c++ as this feature it is not supported by c++.
(1)Base *base_ptr= new derived1();
(2)Base *base_ptr= new derived2();
(3)Base *base_ptr= new derived3();
can those derived object ype can be assigned through vector or string?
I.e
string list []={"derived1","derived2","derived3"};
so now (1) , (2) and (3) can be replaced by:
(1)Base *base_ptr= new list[0]();
(2)Base *base_ptr= new list[1]();
(3)Base *base_ptr= new listt[3]();
this approach will be very helpful to remove no. of if and else while implementing factory pattern.