[Cs3] singleton implementations

Mikhail Nesterenko mikhail at cs.kent.edu
Fri Mar 15 14:37:44 EDT 2019


> 
> I am wondering about if it is possible to create a functor
> singleton. Then, use it to edit the object through the parenthesis
> instead of having to use the arrow operator for every operation.
> 

I do not see how a functor helps because you are not able to create a
Singleton object. However, a wrapper class can be created that hides
the singleton internally and passes all the operations to it. This
technique is called delegation and we are studying it later.

Alternatively. The singleton implementation can return a reference so
the client can use a dot operator rather than the reference operator.

thanks,
--
Mikhail


More information about the cs3 mailing list