7/21/2010

C# Structure



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Structures
{
    struct person
    {
        string name;
        int age;

        public person(string name,int age) 
        {
            this.name = name;
            this.age = age;
        }

        public void print()
        {
            Console.WriteLine("Name: " + name + "\n Age: " + age);
        }

    }
    class Program
    {
        static void Main(string[] args)
        {
            person p = new person("Kamran",24);
            p.print();
            
        }
    }
}

No comments:

Post a Comment