I am working on a sound library (with OpenAL) and am inspired by the interface provided by FMOD, you can see the interface at this link .
I introduced several concepts such as Sound, Channel and ChannelGroup, as you can see through the FMOD interface, all these classes have a private constructor and, for example, if you create the sound that you use, use the createSound () function provided by the System ( same if you create a channel or group of channels).
I would like to provide a similar mechanism, but I do not understand how it works. For example, how can the createSound () function create a new sound value? The constructor is private, and there are no static methods or friendships from the Sound interface. Are some templates used?
EDIT: just to make the OP question clear, he / she does not ask how to instantiate a class with a private constructor. The question is in the posted link. How to create an instance of classes that have a private constructor and NO static methods or functions of friends.
Thank.
source
share