MCQs>IT & Programming>C#>What is the result of the following code ? public static void Main() { Derived2 d = new Derived2(); Console.WriteLine(d.GetTempValue()); } public class BaseClass { public virtual int GetTempValue() { return 1; } } public class Derived1 : BaseClass { public sealed override int GetTempValue() { return 2 * base.GetTempValue(); } } public class Derived2 : Derived1 { public sealed override int GetTempValue() { return 2 * base.GetTempValue(); } }
C# MCQs
What is the result of the following code ? public static void Main() { Derived2 d = new Derived2(); Console.WriteLine(d.GetTempValue()); } public class BaseClass { public virtual int GetTempValue() { return 1; } } public class Derived1 : BaseClass { public sealed override int GetTempValue() { return 2 * base.GetTempValue(); } } public class Derived2 : Derived1 { public sealed override int GetTempValue() { return 2 * base.GetTempValue(); } }
Answer
Correct Answer: Compiler error
Explanation:
Note: This Question is unanswered, help us to find answer for this one