17/02/2010
Array
int[] a = new int[10];
int[0] = 1;
…
Valuable & Array : still same data typeClass: property
class(student)
{
int StudentId;
string StudentName;
double StudentMarks;
}
student s;
s = new student(); ←Constructor or Method
*default 0, NULL or false
Method: actionclass Auto
{
string name;
double price;
string color;
int tyreNo;
}
void ChangeColor()
*every method must have return data type.
{
}
Ex.Message()
{
Console.WriteLine("Hello. How are you?");
Console.WriteLine("What are you doing?");
Console.WriteLine("I'm waiting for you.");
}
Console.WriteLine("Before Method call.");
Message();
Console.WriteLine("After Method call.");
i, j=parameter1,2=arithmetic
Ex.
Sum(int i, int j)
{
int sum = i+j;
return sum;
}
int d = 10;
int e = Sum(5,6);
int c = d+e;
Console.WriteLine(c);
Result 21Ex.
void xyz()
{
return xyz; ←error (void means no return.)
}
0 件のコメント:
コメントを投稿