Quantcast
Viewing latest article 1
Browse Latest Browse All 4

Answer by midor for Java this in parent and child not working as expected

The way you would set the s-member in the parent-portion of a child-class, would be to offer a protected constructor (it could, of course, also be public):

protected Parent(String s) { this.s = s; }

which sets the string to the given value. You would then call this constructor as the first call in your child-constructor with

super("Whatever you want");


Viewing latest article 1
Browse Latest Browse All 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>