Sunday, 22 August 2010

source code for this pointer

using System;
namespace OOPSProject
{
class Params
{
int x, y; // Class Variables
Params(int x, int y) //Block Variables
{
this.x = x;
this.y = y;
}
void Add()
{
Console.WriteLine(x + y);
}
void Sub()
{
Console.WriteLine(x - y);
}
void Mul()
{
Console.WriteLine(x * y);
}
void Div()
{
Console.WriteLine(x / y);
}
static void Main()
{
Params obj = new Params(100, 50);
obj.Add(); obj.Sub(); obj.Mul(); obj.Div();
Console.ReadLine();
}
}
}

No comments:

Post a Comment