Parameterized Constructor

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

namespace ParameterizedConstructorExamples
{
    class Program
    {
        static void Main(string[] args)
        {
            Test T = new Test(10,20);
            T.Print();
            Console.Read();
        }
    }
    class Test
    {
        int A, B;
        public Test(int X, int Y)
        {
            A = X;
            B = Y;
        }
        public void Print()
        {
            Console.Write("A ={0} and B={1}",A,B);
        }
    }
}

Share:

No comments:

Post a Comment

Monday, 31 August 2015

Parameterized Constructor

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

namespace ParameterizedConstructorExamples
{
    class Program
    {
        static void Main(string[] args)
        {
            Test T = new Test(10,20);
            T.Print();
            Console.Read();
        }
    }
    class Test
    {
        int A, B;
        public Test(int X, int Y)
        {
            A = X;
            B = Y;
        }
        public void Print()
        {
            Console.Write("A ={0} and B={1}",A,B);
        }
    }
}

No comments:

Post a Comment

Popular

Total Pageviews

Archive