ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Google
   
 
Categories >> Software >> Microsoft Related >> C Sharp
 
 


 

 
 Visual Basic interview questions  Visual Basic Interview Questions (615)
 C Sharp interview questions  C Sharp Interview Questions (722)
 ASP.NET interview questions  ASP.NET Interview Questions (1444)
 VB.NET interview questions  VB.NET Interview Questions (150)
 COM+ interview questions  COM+ Interview Questions (41)
 ADO.NET interview questions  ADO.NET Interview Questions (199)
 IIS interview questions  IIS Interview Questions (86)
 MTS interview questions  MTS Interview Questions (5)
 Crystal Reports interview questions  Crystal Reports Interview Questions (62)
 BizTalk interview questions  BizTalk Interview Questions (33)
 Dot Net interview questions  Dot Net Interview Questions (861)
 Exchange Server interview questions  Exchange Server Interview Questions (103)
 SharePoint interview questions  SharePoint Interview Questions (25)
 WCF interview questions  WCF Interview Questions (8)
 Microsoft Related AllOther interview questions  Microsoft Related AllOther Interview Questions (193)
Question
How do you create multiple inheritance in C#?
 Question Submitted By :: C-Sharp
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
C# does'nt support multiple inheritance. In that situation
we use interface
 
Is This Answer Correct ?    106 Yes 8 No
Shafi Syed
 
Answer
# 2
if u want to crate multile inheritance in C#

u can use intface
 
Is This Answer Correct ?    98 Yes 10 No
Jiten
 
 
 
Answer
# 3
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TestApp
{
class MultipleInheritance : first, Isecond
{
Isecond objsecond = new second();

#region Isecond Members

public void secondfunction()
{
objsecond.secondfunction();
}

#endregion
}
class first
{
public first()
{
}

public void firstfunction()
{
Console.WriteLine("First funciton called");
}
}
interface Isecond
{
void secondfunction();
}
class second : Isecond
{
public second()
{
}

public void secondfunction()
{
Console.WriteLine("Second function called");
}
}

class Program
{
static void Main(string[] args)
{
//multiple inheritance
MultipleInheritance obj = new MultipleInheritance();
obj.firstfunction();
obj.secondfunction();

Console.ReadLine();
}
}
}
 
Is This Answer Correct ?    47 Yes 19 No
Neeraj Tyagi
 
Answer
# 4
C# doesn't support Multiple Inheritance,,,SO to over come this problem Interface came into picture.Interface is not a class,but it is a parent to base class.

Interface Forest
{
void Greet();
}

class Animal: Forest
{
public void Greet()
{
Console.WriteLine("Animal says Hello");
}

public void Sing()
{
Console.WriteLine("Animal Sings");
}
}

class Program : Animal,Forest
{
static void Main(string[] args)
{
Program obj = New Program();
obj.Greet();
obj.Sing();
Console.ReadLine();
}
}
 
Is This Answer Correct ?    5 Yes 3 No
Pavankumar
 
Answer
# 5
using System;

interface Interdemo
{
void Show();
}

class Interimp:Interdemo
{
public void Show()
{
Console.WriteLine("Show() method Implemented");
}

public static void Main(string[] args)
{
Interimp inter = new Interimp();
inter.Show();
}
}
 
Is This Answer Correct ?    36 Yes 36 No
Frank
 

 
 
 
Other C Sharp Interview Questions
 
  Question Asked @ Answers
 
What if an error occurs in Catch block, how can you prevent it? IBM 2
What are the types of threading models ? Digital-GlobalSoft 4
What is the Main difference between String and StringBuilder and why do we use StringBuilder. Siemens 15
Can you declare the override method static while the original method is non-static?   3
How do you debug an ASP.NET Web application?   1
What is the use of giving more than one CATCH BLOCK in one TRY block? Directly we can give that catch(Exception e)?Why we go for arrayoutofbound Exception,divided by zero etc..? Explain   2
What are the security issues if we send a query from the application? Microsoft 1
How to include c++ header files in c# components? UST 1
What?s the difference between the Debug class and Trace class?   2
Write an expression which satisfies the following statements: (i) Creates an object of type q (ii) If m is null, returns n, otherwise returns m (iii) If x and y are string types, it concatenates x and y   1
if i want to transmit binary data,,,will it be support by Webservices or any exceptions ? define   2
i need to insert data into sql server table emp through textboxes txtname and txtsalary using c# code. Please help   1
 
For more C Sharp Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com