-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo5.java
More file actions
58 lines (57 loc) · 908 Bytes
/
demo5.java
File metadata and controls
58 lines (57 loc) · 908 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import java.util.*;
class Person
{
private int id;
private String name;
Person(int a, String b)
{
this.id=a;
this.name=b;
}
void showdata()
{
System.out.print("Id:"+id+" Name:"+name);
}
};
abstract class Employee extends Person
{
private int salary;
int retsal()
{
return salary;
}
Employee(int a,String b,int c)
{
super(a,b);
this.salary=c;
}
abstract void showsal();
};
class Manager extends Employee
{
private String desig;
Manager(int a,String b,int c,String d)
{
super(a,b,c);
this.desig=d;
}
void showsal()
{
showdata();
System.out.print(" Designation:"+desig);
}
};
class demo5
{
public static void main(String args[])
{
Person p=new Person(101,"Nabeel");
p.showdata();
System.out.println('\n');
Employee e;
//System.out.println('\n');
Manager m=new Manager(103,"ABC",12000,"Vice President");
m.showsal();ß
System.out.println('\n');
}
};