Constructor (object-oriented programming): Difference between revisions

Content deleted Content added
rvv
Line 8:
//declaration of instance [[variable (computer science)|variable]](s).
protected int data;
protected int data2;
//definition of the '''constructor'''.
Line 13 ⟶ 14:
{
data = 1;
}
data = 2;
 
//overloading a constructor
public Example(int input)
{
datadata2 = 2input;
}
}