Header File Dependencies

  什么时候可以用前置声明替代include?

  1、当 declare/define pointer&reference 时。 

  2、当 declare static data member 时。

  3、当 declare function 时。

    So,下面这段代码会被正常编译通过:

#include <stdio.h>

class Point;

struct Square
{
    Point *pt;
    Point &ref;
    static Point point;
};

void xshow(Point p); 

void show()
{
    printf("Hello world");
}

  

相关文章:

  • 2022-12-23
  • 2021-12-25
  • 2022-12-23
  • 2021-12-16
  • 2022-01-02
  • 2022-12-23
  • 2021-08-31
  • 2021-04-10
猜你喜欢
  • 2021-05-25
  • 2022-12-23
  • 2022-12-23
  • 2021-10-16
  • 2021-11-21
  • 2021-10-05
  • 2021-07-08
相关资源
相似解决方案