Function new() overriding ? why should we call super.new() function in derived class constructor?

In reply to dave_59:

hi dave , thank you very much.

i understood that clearly. we must include super.new() while creating extended class object.

in this example. generally the tool should not show error when super.new() will delete.
please make sure me about this.


following code should not show any error message because i am creating object for class A, class A is not extends by other class. while creating object the line3 will call then it works good.

but it is not happening like that.

error message are
" super class constructor has non-default arguments. arguments ca be specified by calling super.new() explicitly "

" number of actuals and formals does not match in task call "

Line 1: class A;
Line 2: int x;
Line 3: function new(int a);
Line 4: x=a;
Line 5: endfunction
Line 6: endclass

Line 7: class B extends A;
Line 8: int p;
Line 9: function new(int a);

Line10: p=a;
Line11: endfunction
Line12: endclass

Line13: program new_fun ;
Line14: A a_o;
Line15: initial
Line16: begin
Line17: a_o = new(1);
Line18: end
Line19: endprogram