>> class PrivateClass;
>
>> class MyClass
>> {
>> std::shared_ptr<PrivateClass> privateObject;
>> };
OK. That seems easy enough.
> Oh, and take into account that if instances of MyClass are copied around,
> the copies will share the one and same PrivateClass object. That will not
> get deep-copied. (That's what the "shared ptr" means, actually.)
There "should" only ever be one instance of this class; I'd just like to
avoid the program exploding if somebody *does* copy that instance for
some reason. A shallow copy is acceptable.
Post a reply to this message
|