Use Forward Declarations to Speed Up Compiling

If class B uses only pointers or references of class A, you don’t have to include A.h. You can simply forward declare class A as shown below.

 //File B.hclass A; //forward Decalarationclass B{  A * ptrA;  .. //other members};
Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: