Object Oriented Programming using C#

(backadmin) #1

Object Oriented Programming using C#
Generic Collections and how to Serialize them


static public int Highest(int o1, int o2)
{
if (o1 > o2)
return o1;
else
return o2;
}
static public double Highest(double o1, double o2)
{
if (o1 > o2)
return o1;
else
return o2;
}

Given the following code the CLR engine will invoke the first of these methods then the second as the correct method to
implement is identified by its name and the type of its parameters.


int n1 = 1;
int n2 = 2;
Console.WriteLine(“The highest is “ + Highest(n1, n2));
double n3 = 1.1;
double n4 = 2.2;
Console.WriteLine(“The highest is “ + Highest(n3, n4));

Given the following definition of a Student class...


class Student
{
String name;
public Student(String name)
{
this.name = name;
}
override public string ToString()
{
return name;
}
}
Free download pdf