Are array of pointers to different types possible in c++?

后端 未结 7 624
灰色年华
灰色年华 2020-12-18 03:46

Are array of pointers to different types possible in c++? with example please)

7条回答
  •  天命终不由人
    2020-12-18 04:02

    Yes; just cast your pointers in the array to whatever type you want them to refer to.

    Alternately, you could make your array an array of a union (with the union elements being the differing pointer types).

提交回复
热议问题