Pros and cons of using nested C++ classes and enumerations?

前端 未结 13 2179
悲&欢浪女
悲&欢浪女 2020-11-29 23:43

What are the pros and cons of using nested public C++ classes and enumerations? For example, suppose you have a class called printer, and this class also store

13条回答
  •  一生所求
    2020-11-30 00:30

    If you're never going to be using the dependent class for anything but working with the independent class's implementations, nested classes are fine, in my opinion.

    It's when you want to be using the "internal" class as an object in its own right that things can start getting a little manky and you have to start writing extractor/inserter routines. Not a pretty situation.

提交回复
热议问题