Saturday, April 26, 2025

C# OO - Object Modification

Program.cs


using System;

namespace LearnCS
{
    class Person
    {
        string name;
        string lastname;
        int SSN;

        static void Main(string[] args)
        {

            Person p1 = new Person();
            p1.name = "John";
            p1.lastname = "Snow";
            p1.SSN = 456465456;

            Console.WriteLine("P1 Name: " + p1.name);
            Console.WriteLine("P1 LastName: " + p1.lastname);
            Console.WriteLine("P1 SSN: " + p1.SSN);

            p1.SSN = 1111111111;

            Console.WriteLine("P1 Name: " + p1.name);
            Console.WriteLine("P1 LastName: " + p1.lastname);
            Console.WriteLine("P1 SSN: " + p1.SSN);

            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 .  ...