About initial block

why initial block is not allowed inside the class?

In reply to Lakshman4178:

If you check the 1800-2017 SV LRM section 9.2 Structured procedures, you find the following

“The initial and always procedures are enabled at the beginning of a simulation. The initial procedure shall
execute only once, and its activity shall cease when the statement has finished
. In contrast, an always procedure shall execute repeatedly, and its activity shall cease only when the simulation is terminated.”

A class object can be created dynamically at any time, “any” number of times, therefore allowing the initial block in a class will be violating the above specified description.

HTH,
-R