TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Mutilevel Inheritance
Sandeep Kumar
Dec 21
2015
Code
572
0
1
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
Multi level Inherita
1. Class Person
2. String PName,PColor,PQualification,PDesignation;
3. Int PAge;
4. Public
void
Get()
5. {
6. Console.WriteLine(
"Enter the person's Name,Color,Qualification,Designation and Age "
);
7. This.Pname=Console.ReadLine();
8. This.PColor=Console.ReadLine();
9. This.PQualification=Console.ReadLine();
10. This.PDesignation=Console.ReadLine();
11. This.PAge=Convert.ToInt32(Console.ReadLine());
12. }
13. Public
void
Display()
14. {
15. Console.WriteLine(
"Person Name is :"
+This.PName);
16. Console.WriteLine(
"Person Color is :"
+This.PColor);
17. Console.WriteLine(
"Person Qualification is :"
+This.PQualification);
18. Console.WriteLine(
"Person Designation is :"
+This.PDesignation);
19. Console.WriteLine(
"Person Age is :"
+This.PAge);
20. }
21. Class Father:Person
22. String FName,FColor;
23. Int FAge;
24. Public
void
Get()
25. {
26. Console.WriteLine(
"Enter the Person’s Father Name,Color and Age "
);
27. This.FName=Console.ReadLine();
28. This.FColor=Console.ReadLine();
29. This.FAge=Convert.ToInt32(Console.ReadLine());
30. }
31. Public
void
Display()
32. {
33. Console.WriteLine(
"Father’s Name is :"
+This.FName);
34. Console.WriteLine(
"Father’s Color is :"
+This.FColor);
35. Console.WriteLine(
"Father’s Age is :"
+This.FAge);
36. }
37. Class Mother:Father
38. String MName,MColor;
39. Int MAge;
40. Public
void
Get()
41. {
42. Console.WriteLine(
"Enter the Person’s Mother Name,Color and Age "
);
43. This.MName=Console.ReadLine();
44. This.MColor=Console.ReadLine();
45. This.MAge=Convert.ToInt32(Console.ReadLine());
46. }
47. Public
void
Display()
48. {
49. Console.WriteLine(
"Mother’s Name is :"
+This.MName);
50. Console.WriteLine(
"Mother’s Color is :"
+This.MColor);
51. Console.WriteLine(
"Mother’s Age is :"
+This.MAge);
52. }
53. Class MultilevelInheritance
54.
public
void
Main()
55. {
56. Mother obj=
new
Mother();
57. obj.Get();
58. obj.Display();
59. }
60. Console.Read();
61. }
Multilevel Inheritance
C#