Jan 5, 2001 #1 frag Programmer Dec 7, 2000 321 GB Hi everybody! Could anybody please explain me what "super()" does? Thanx! frag patrick.metz@epost.de
Hi everybody! Could anybody please explain me what "super()" does? Thanx! frag patrick.metz@epost.de
Jan 5, 2001 #2 palbano Programmer Oct 9, 1998 4,341 US runs the constructor for your base (super) class. class foo{ protected int _fooint; public foo(int n){ _fooint = n; } } class myfoo extends foo{ public myfoo(int x){ super(x); // executes foo::foo(int) System.out.println( this._fooint); // will display value of 'x' } } Good luck -pete Upvote 0 Downvote
runs the constructor for your base (super) class. class foo{ protected int _fooint; public foo(int n){ _fooint = n; } } class myfoo extends foo{ public myfoo(int x){ super(x); // executes foo::foo(int) System.out.println( this._fooint); // will display value of 'x' } } Good luck -pete