Select The Sequence Of Execution Of Function F1 F2 038 F3 In C #312
Select the sequence of execution of function f1(), f2() & f3() in C# .NET CODE? </p> <pre><code class="language-csharp" line="1"> class base { public void f1() {} public virtual void f2() {} public virtual void f3() {} } class derived :base { new public void f1() {} public override void f2() {} public new void f3() {} } class Program { static void Main(string[] args) { baseclass b = new derived(); b.f1 (); b.f2 (); b.f3 (); } } </code></pre>
This multiple choice question (MCQ) is related to the book/course gs gs108 CSharp. It can also be found in gs gs108 Object Oriented Concepts - Polymorphism - Quiz No.1.
Select the sequence of execution of function f1(), f2() & f3() in C# .NET CODE?
class base { public void f1() {} public virtual void f2() {} public virtual void f3() {} } class derived :base { new public void f1() {} public override void f2() {} public new void f3() {} } class Program { static void Main(string[] args) { baseclass b = new derived(); b.f1 (); b.f2 (); b.f3 (); } }
f1() of derived class get executed f2() of derived class get executed f3() of base class get executed
f1() of base class get executed f2() of derived class get executed f3() of base class get executed
f1() of base class get executed f2() of derived class get executed f3() of derived class get executed
f1() of derived class get executed f2() of base class get executed f3() of base class get executed