Extending an abstract data class

In the following example, the Emp abstract data class is being extended by the non-abstract Manager data class: 

abstract record Emp(String name, int age); 
record Manager(String name, int age, String country) extends Emp(name, age); 

When a non-abstract data class extends an abstract data class, it accepts all of the data in its header—the ones that are required for itself, and for its base class.

A data class can extend a single abstract data class.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.89.2