Pages

Showing posts with label OOPs. Show all posts
Showing posts with label OOPs. Show all posts

Oops Puzzle1

Object Oriented Programming seems to be tricky usually. This Puzzle is based on Inheritance.

Consider there are 2 Classes
Class A and Class B

class Program
    {
        
        static void Main(string[] args)
        {
            ClassA _objClassA = new ClassB();
            _objClassA.Function1(); 
        }
    }

public Class ClassA
{
    public void Function1()
    {
         Console.WriteLine("ClassA...Function1()");
    }
}
public class ClassB:ClassA
{
    public void Function1()
    {
         Console.WriteLine("ClassB...Function1()");
    }
}


What is the Result of the above Program.
Please do not execute this program. Try to solve by looking code.