SlideShare a Scribd company logo
B.Sc.IT (Semester: V)
ASP.NET With C# [Practical Question]
QUESTION Write a program to show the example of Hybrid
Inheritance.
SOLUTION
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class A
{
public int a;
public A(int p)
{
a = p;
}
public void showA()
{
Console.WriteLine(“A=” + a);
}
}
class B : A
{
int b;
public B(int z, int y)
: base(z)
{
b = y;
}
public void showB()
{
Console.WriteLine(“B=” + b);
}
}
class C : A
{
int c;
public C(int x, int m)
: base(x)
{
c = m;
}
public void showC()
{
Console.WriteLine(“C=” + c);
}
}
class D : B
{
int d;
public D(int x, int y, int z)
: base(x, y)
{
d = z;
}
public void showD()
{
Console.WriteLine(“D=” + d);
}
}
class Program
{
static void Main(string[] args)
{
C c1 = new C(5, 9);
D d1 = new D(4, 2, 3);
c1.showA();
c1.showC();
d1.showA();
d1.showB();
d1.showD();
Console.ReadKey();
}
}
}

More Related Content

PPT
Python Pandas
PPSX
JDBC: java DataBase connectivity
PPSX
Modules and packages in python
PPTX
OOPS Basics With Example
PPTX
Inheritance in c++
PPT
Android software stack
PDF
Android Networking
PPTX
Basic concepts for python web development
Python Pandas
JDBC: java DataBase connectivity
Modules and packages in python
OOPS Basics With Example
Inheritance in c++
Android software stack
Android Networking
Basic concepts for python web development

What's hot (20)

PPTX
object oriented Programming ppt
PPTX
Packages,static,this keyword in java
PPTX
Mongo db
PPTX
10 implementing subprograms
DOCX
Java collections notes
PPTX
Java program structure
PDF
Lesson 2 Understanding Linux File System
PPTX
class and objects
PDF
Web technology lab manual
PDF
Java programming lab manual
PDF
java notes.pdf
ODP
Data Analysis in Python
PPTX
Polymorphism in c++(ppt)
PPT
wamp.ppt
PDF
Android chapter16-web-services
PPTX
COMPILATION PROCESS IN C.pptx
PPTX
Python: Third-Party Libraries
PPTX
Java Inheritance
PPT
RichControl in Asp.net
PPTX
L21 io streams
object oriented Programming ppt
Packages,static,this keyword in java
Mongo db
10 implementing subprograms
Java collections notes
Java program structure
Lesson 2 Understanding Linux File System
class and objects
Web technology lab manual
Java programming lab manual
java notes.pdf
Data Analysis in Python
Polymorphism in c++(ppt)
wamp.ppt
Android chapter16-web-services
COMPILATION PROCESS IN C.pptx
Python: Third-Party Libraries
Java Inheritance
RichControl in Asp.net
L21 io streams
Ad

Similar to Write a program to show the example of hybrid inheritance. (20)

PPTX
29csharp
PPTX
PPT
20. Object-Oriented Programming Fundamental Principles
PPT
20 Object-oriented programming principles
PPTX
Object oriented programming Fundamental Concepts
PDF
Xamarin: Inheritance and Polymorphism
PPTX
Inheritance
DOCX
C# Unit 2 notes
PDF
Object oriented programming inheritance
PDF
Diving in OOP (Day 3): Polymorphism and Inheritance (Dynamic Binding/Run Time...
PDF
7 inheritance and polymorphism
DOCX
C# programs
DOCX
39927902 c-labmanual
DOCX
39927902 c-labmanual
PPTX
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
PDF
C# (This keyword, Properties, Inheritance, Base Keyword)
DOCX
PPT
An Introduction to C# and .NET Framework (Basic)
PPTX
C# interview
PPT
Introduction to C#
29csharp
20. Object-Oriented Programming Fundamental Principles
20 Object-oriented programming principles
Object oriented programming Fundamental Concepts
Xamarin: Inheritance and Polymorphism
Inheritance
C# Unit 2 notes
Object oriented programming inheritance
Diving in OOP (Day 3): Polymorphism and Inheritance (Dynamic Binding/Run Time...
7 inheritance and polymorphism
C# programs
39927902 c-labmanual
39927902 c-labmanual
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# (This keyword, Properties, Inheritance, Base Keyword)
An Introduction to C# and .NET Framework (Basic)
C# interview
Introduction to C#
Ad

More from Mumbai B.Sc.IT Study (20)

PDF
Linux System Administration (November – 2018) [Choice Based | Question Paper]
PDF
Advanced Web Programming (November – 2018) [Choice Based | Question Paper]
PDF
Artificial Intelligence (November – 2018) [Choice Based | Question Paper]
PDF
Software Project Management (November – 2018) [Choice Based | Question Paper]
PDF
Next Generation Technologies (November – 2018) [Choice Based | Question Paper]
PDF
Internet Of Things (November – 2018) [Choice Based | Question Paper]
PDF
Enterprise Java (November – 2018) [Choice Based | Question Paper]
PDF
Enterprise Networking (May – 2019) [Choice Based | Question Paper]
PDF
Business Intelligence (May – 2019) [Choice Based | Question Paper]
PDF
Software Quality Assurance (May – 2019) [Choice Based | Question Paper]
PDF
Project Management (April - 2016) [CBSGS - Paper Solution] {Mumbai University}
PDF
Project Management (April - 2015) [CBSGS - Paper Solution] {Mumbai University}
PDF
Project Management (October - 2017) [CBSGS - Paper Solution] {Mumbai University}
PDF
Project Management (October - 2016) [CBSGS - Paper Solution] {Mumbai University}
PDF
Project Management (October - 2015) [CBSGS - Paper Solution] {Mumbai University}
PDF
Project Management (October - 2014) [CBSGS - Paper Solution] {Mumbai University}
PDF
Project Management (May - 2018) [CBSGS - Paper Solution] {Mumbai University}
PDF
Project Management (April - 2017) [CBSGS - Paper Solution] {Mumbai University}
PDF
Project Management (April - 2014) [CBSGS - Paper Solution] {Mumbai University}
PDF
Internet Technology (Practical Questions Paper) [CBSGS - 75:25 Pattern] {2017...
Linux System Administration (November – 2018) [Choice Based | Question Paper]
Advanced Web Programming (November – 2018) [Choice Based | Question Paper]
Artificial Intelligence (November – 2018) [Choice Based | Question Paper]
Software Project Management (November – 2018) [Choice Based | Question Paper]
Next Generation Technologies (November – 2018) [Choice Based | Question Paper]
Internet Of Things (November – 2018) [Choice Based | Question Paper]
Enterprise Java (November – 2018) [Choice Based | Question Paper]
Enterprise Networking (May – 2019) [Choice Based | Question Paper]
Business Intelligence (May – 2019) [Choice Based | Question Paper]
Software Quality Assurance (May – 2019) [Choice Based | Question Paper]
Project Management (April - 2016) [CBSGS - Paper Solution] {Mumbai University}
Project Management (April - 2015) [CBSGS - Paper Solution] {Mumbai University}
Project Management (October - 2017) [CBSGS - Paper Solution] {Mumbai University}
Project Management (October - 2016) [CBSGS - Paper Solution] {Mumbai University}
Project Management (October - 2015) [CBSGS - Paper Solution] {Mumbai University}
Project Management (October - 2014) [CBSGS - Paper Solution] {Mumbai University}
Project Management (May - 2018) [CBSGS - Paper Solution] {Mumbai University}
Project Management (April - 2017) [CBSGS - Paper Solution] {Mumbai University}
Project Management (April - 2014) [CBSGS - Paper Solution] {Mumbai University}
Internet Technology (Practical Questions Paper) [CBSGS - 75:25 Pattern] {2017...

Recently uploaded (20)

PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Pre independence Education in Inndia.pdf
PPTX
Institutional Correction lecture only . . .
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
RMMM.pdf make it easy to upload and study
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
Pharma ospi slides which help in ospi learning
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
Insiders guide to clinical Medicine.pdf
PPTX
Cell Structure & Organelles in detailed.
PPTX
GDM (1) (1).pptx small presentation for students
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
human mycosis Human fungal infections are called human mycosis..pptx
Supply Chain Operations Speaking Notes -ICLT Program
Pre independence Education in Inndia.pdf
Institutional Correction lecture only . . .
PPH.pptx obstetrics and gynecology in nursing
Anesthesia in Laparoscopic Surgery in India
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
RMMM.pdf make it easy to upload and study
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Pharma ospi slides which help in ospi learning
Pharmacology of Heart Failure /Pharmacotherapy of CHF
O5-L3 Freight Transport Ops (International) V1.pdf
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Insiders guide to clinical Medicine.pdf
Cell Structure & Organelles in detailed.
GDM (1) (1).pptx small presentation for students
102 student loan defaulters named and shamed – Is someone you know on the list?
Renaissance Architecture: A Journey from Faith to Humanism

Write a program to show the example of hybrid inheritance.

  • 1. B.Sc.IT (Semester: V) ASP.NET With C# [Practical Question] QUESTION Write a program to show the example of Hybrid Inheritance. SOLUTION using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class A { public int a; public A(int p) { a = p; } public void showA() { Console.WriteLine(“A=” + a); } } class B : A { int b; public B(int z, int y) : base(z) { b = y; } public void showB() { Console.WriteLine(“B=” + b); } } class C : A {
  • 2. int c; public C(int x, int m) : base(x) { c = m; } public void showC() { Console.WriteLine(“C=” + c); } } class D : B { int d; public D(int x, int y, int z) : base(x, y) { d = z; } public void showD() { Console.WriteLine(“D=” + d); } } class Program { static void Main(string[] args) { C c1 = new C(5, 9); D d1 = new D(4, 2, 3); c1.showA(); c1.showC(); d1.showA(); d1.showB(); d1.showD(); Console.ReadKey(); } } }