Why include a header and forward declare the class contained in the same cpp file?

前端 未结 4 580
难免孤独
难免孤独 2021-01-13 08:14

I\'ve been looking at the Fear SDK for my university project, but have noticed some code like so:

Foo.h

class Foo
{
    public:
        int iSomethin         


        
4条回答
  •  猫巷女王i
    2021-01-13 08:46

    The forward declaration is redundant, but also quite harmless. Maybe the author uses a lot of forward declarations, and doesn't rigorously ensure they are always required.

提交回复
热议问题