C++ what to code if i put a class after main() function

前端 未结 5 1030
滥情空心
滥情空心 2020-12-30 17:26

I\'m watching some video tutorials on C++ and i know you must define a function / class before it is used or called. But I like having my main() function at the top, and eve

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-30 17:53

    You cannot create an actual instance of the type (variable, value member) until the type is fully defined, as its size is not known. There is no way around that, but there is a lot you can already do with a pointer to an incomplete type.

提交回复
热议问题