C++ - when should I use a pointer member in a class

后端 未结 4 2179
庸人自扰
庸人自扰 2020-12-07 17:02

One of the thing that has been confusing for me while learning C++ (and Direct3D, but that some time ago) is when you should use a pointer member in a class. For example, I

4条回答
  •  没有蜡笔的小新
    2020-12-07 17:32

    Another reason to use pointers would be dynamic binding. If you have a base class with a virtual method and some derived classes, you can only get dynamic binding using pointers.

提交回复
热议问题