Why is this program not polymorphic? [closed]

In

public void A1(int a,int b){
    c = this.a+this.b;
}

You are ignoring the parameters you are passing to your method, and add the instance variables this.a and this.b instead.

Change it to

public void A1(int a,int b){
    c = a+b;
}

in order to add the two arguments.

Leave a Comment