ExamVeda
Login
Home
Classes and Objects in C Sharp
?

The following C# code is run on single level of inheritance. What will be the Correct statement in the following C# code?
class sample
{
    int i = 10;
    int j = 20;
    public void display() 
    {
        Console.WriteLine("base method ");
    }
}    
class sample1 : sample 
{
    public  int s = 30;
}    
class Program
{
    static void Main(string[] args)
    {
        sample1 obj = new sample1();
        Console.WriteLine("{0}, {1}, {2}", obj.i,  obj.j,  obj.s);
        obj.display();
        Console.ReadLine();
    }
}

Answer & Solution
Correct Answer: Option C
Let's discuss the solution. Join the discussion
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.