2010/02/19

C# week4_3


17/02/2010
Array
int[] a = new int[10];
int[0] = 1;
Valuable & Array : still same data type


Class: property
class(student)
{
int StudentId;
string StudentName;
double StudentMarks;
}
student s;
s = new student(); Constructor or Method
*default 0, NULL or false
Method: action
class 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=parameter
1,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 21


Ex.
void xyz()
{
return xyz; error (void means no return.)
}


 

0 件のコメント:

コメントを投稿

UA-9417263-1