C# program that contains different classes but no inheritance

Category > CSHARP || Published on : Tuesday, November 10, 2020 || Views: 38 || contains different classes but no inheritance


Here Pawan Kumar will explain how to contains different classes but no inheritance

using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication15
{
    class A
    {
        public void Show()
        {
            Console.WriteLine("Show A");
        }
    }
    class B
    {
        public void Show()
        {
            Console.WriteLine("Show B");
        }
    }
    class Demo
    {
        static void Main(string[] args)
        {
            A a = new A();
            a.Show();
            B b = new B();
            b.Show();
            Console.ReadLine();
        }
    }
}