Create | Hello Guest |
Which of the following can be facilitated by the Inheritance mechanism?
|
class BaseClass{protected int i = 13;}class Derived: BaseClass{int i = 9;public void fun(){// [*** Add statement here ***]}}
namespace IndiabixConsoleApplication{class index{protected int count;public index(){count = 0;}}class index1: index{public void increment(){count = count +1;}}class MyProgram{static void Main(string[] args){index1 i = new index1();i.increment();}}}
namespace IndiabixConsoleApplication{class Baseclass{private int i;protected int j;public int k;}class Derived: Baseclass{private int x;protected int y;public int z;}class MyProgram{static void Main (string[ ] args){Derived d = new Derived();}}}
namespace IndiabixConsoleApplication{class A{public void fun(){Console.Write("Welcome");}}class B: A{public void fun(){// [*** Add statement here ***]Console.WriteLine(" to IndiaBIX.com!");}}class MyProgram{static void Main (string[ ] args){B b = new B();b.fun();}}}
namespace IndiabixConsoleApplication{class Baseclass{public void fun(){Console.Write("Base class" + " ");}}class Derived1: Baseclass{new void fun(){Console.Write("Derived1 class" + " ");}}class Derived2: Derived1{new void fun(){Console.Write("Derived2 class" + " ");}}class Program{public static void Main(string[ ] args){Derived2 d = new Derived2();d.fun();}}}
namespace IndiabixConsoleApplication{class Baseclass{public void fun(){Console.WriteLine("Hi" + " ");}public void fun(int i){Console.Write("Hello" + " ");}}class Derived: Baseclass{public void fun(){Console.Write("Bye" + " ");}}class MyProgram{static void Main(string[ ] args){Derived d;d = new Derived();d.fun();d.fun(77);}}}