Consider the below

class OuterClass
{
public void SayHelloFromOuterClass()
{
Console.WriteLine("Hello from Outer Class");
}

public class InnerClass
{
public void SayHelloFromInnerClass()
{
Console.WriteLine("Hello from Inner Class");
}
}
}

How to invoke SayHelloFromInnerClass() method?

 Posted by Rajnilari2015 on 12/5/2015 | Category: C# Interview questions | Views: 616 | Points: 40
Select from following answers:
  1. new InnerClass().SayHelloFromInnerClass();
  2. new OuterClass.SayHelloFromInnerClass();
  3. new OuterClass.InnerClass().SayHelloFromInnerClass();
  4. var innerClass = new OuterClass.InnerClass();innerClass.SayHelloFromInnerClass();
  5. All Above

Show Correct Answer


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response