If I have two classes "A" and "B", is it OK to derive B from A and then make B a Singleton?.
Thanks for your help.
Um, sure. Nobody is going to stop you.
If it's okay to make "some class" a singleton * , just imagine B being a new "some class". (It just happens to be derived from A.)
* Though, do you really need a singleton ? (No.)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.