In reply to dave_59:
I have changed the file extension to .sv and didn’t give switch(-sv) to make everything compile as system verilog.
I compile fil2.sv as the last file and it has timescale 1ps/1ps but as per my understanding from LRM, the class file2.sv should take the default timescale 1ns/1ns.
LRM - The time unit of the compilation-unit scope can only be set by a timeunit declaration, not a `timescale directive.