prashant bathani
Q. Is it possible to achieve a mechanism like multiple inheritance in c# without using interface ?
By prashant bathani in C# on Nov 07 2015
  • Vineet Kumar
    Jan, 2017 13

    No

    • 0
  • Keerthi Venkatesan
    Apr, 2016 11

    to overcome mulitple inheritance we can use only interface

    • 0
  • Sunil Babu
    Apr, 2016 2

    No

    • 0
  • prashant bathani
    Nov, 2015 7

    Yes it is possible in c# for more details see below example.using System; using System.Collections.Generic; using System.Linq; using System.Text;namespace LearningPractice {class MultipleInheritance{// Listing 1 : FamilyClasspublic class FamilyClass{public FamilyClass(){ }protected void GetFamilyName(){}}// Listing 2 : GrandClasspublic abstract class GrandClass{protected int age;protected string name;public GrandClass(){}public void GetGrandName(){}protected void GetGrandAge(){}}// Listing 3 : ParentClasspublic class ParentClass:FamilyClass{private void GetMotherName(){}// GrandClasspublic class ChildClass:GrandClass{public ChildClass(){ }public void ChildMethod(){ParentClass plsClass = new ParentClass();GetGrandName(); // GrandClassGetGrandAge(); // GrandClassplsClass.GetMotherName(); // Parent ClassplsClass.GetFamilyName(); // Family Class} }}static void Main1(string[] args){}} }

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS