
here
class User
is defined. Now we define constructor
User(String username, int age)
inside this class. Constructor defines the arguments which are to be passed to the object/instance during invoking the class.
One class can inherit from other.



The class User( ) is written before. Now another class SuperUser( ) extending/inheriting class User is defined. Now before writing the line:
SuperUser(String username, int age) : super(username, age);
the following error shows:

For this we define the constructor and assign the same arguments as the parent class, by using super( ). [super is a keyword].
Also in the extended class SuperUser, we define an additional function publish(), exclusively for this class, (not the parent one).