Saturday, April 26, 2025

C# OO - Inheritance

Program.cs

using System;

namespace LearnCS
{
    class Prim
    {
        public string primString = "Value From Prim Class";

        public void primPrinter()
        {
            Console.WriteLine("I am result of primPrinter Method");
        }
    }

    class Sec : Prim
    {
        public string secString = "Value from Sec Class";
    }
    class Program
    {
        static void Main(string[] args)
        {
            Sec p1 = new Sec();
            Console.WriteLine(p1.primString);
            p1.primPrinter();

            Console.WriteLine(p1.secString);

            Console.ReadLine();
        }
    }
}

No comments:

Post a Comment

Tkinter Introduction - Top Widget, Method, Button

First, let's make shure that our tkinter module is working ok with simple  for loop that will spawn 5 instances of blank Tk window .  ...