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

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -