C++: making custom class to work like both container and normal class? -
i want have myobject store collection (vector-like) of someotherobjects (so, being homogeneous, right?), should iterable , accessible via (myobject[i]).someotherobjectfield1 have normal members myobject.dostuff() , myobject.stuff.
is there option implement such class, or using private std::vector keep objects (which i'm trying avoid - don't private std:: containers) smarter?
prefer composition on inheritance, if goal code reuse. (inheritance should used enable polymorphism, doesn't seem issue in case.)
Comments
Post a Comment