Forward refrencing

Hello pmehro,

When the compiler faces the handle of class declaration which is not declared yet when the other class using that handle. It will reports Error.

Lets say class Y using the handle x , which is not declared yet, so it will report an Error.

To Rectify This solution Typedef is used.

Here is the Example for better interpretation.

class Y ; 
X x; // refers to Class X, which is not yet defined 
endclass 

class X; 
int i; 
endclass

Below is the code to Resolve the Error.

typedef class X; 
class Y ; 
X x; // refers to Class X, which is not yet defined 
endclass 

class X; 
int i; 
endclass