
6.8 Inheritance: Packages: Interfaces
Output: Person Details are………
Id Number:50595
Name:Ramesh
Details from Sub class Student:
Total Marks:97.8
Grade:A
Salary : 30000.0
Line No. 29: //std.salary=19000.00;// error Since salary is private and
is not visible outside the class> However, Line No. 30 std.Set-
Sal(30000.00);//ok
as we are using Set method. The same concept
holds good for Line No. 37as well.
Line No. 32: is calling DisplayData() of super and basic data is displayed. However, for
display of member data belonging to Student2, use is made of public acces-
sory methods GetMarks() and GetSal(), etc., as shown in Line No. 37.
6.4 Using Super Class: ...