Ce afiseaza acest program?
class Point
{
internal int x = 1;
internal int y = 1;
public Point() :this(0, 0)
{
x = 0;
y = 0;
}
public Point(int x, int y)
{
this.x = x;
this.y = y;
}
}
class Line: Point
{
protected Point p;
public Line (int x, int y)
{
p = new Point();
p.x = x;
p.y = y;
}
public int GetLength()
{
return (int)Math.Sqrt((x - p.x)*(x - p.x) + (y - p.y) * (y - p.y));
}
}
struct structuraMea
{
int x;
public int X
{
get { return x; }
set { x = value; }
}
int GetVal()
{
return x;
}
}
class Program
{
static void Change(ref structuraMea s)
{
s.X = 2;
}
static void Main(string[] args)
{
structuraMea t = new structuraMea();
t.X = 1;
Change(ref t);
string s1 = "text";
string s2 = s1.ToString();
System.Console.WriteLine(s1 == s2);
System.Console.WriteLine((object)s1 == (object)s2);
Line line = new Line(2, 2);
System.Console.WriteLine(line.GetLength());
System.Console.ReadLine();
}
Raspuns: True, True, 2
--raspuns True, True, 2
Niciun comentariu:
Trimiteți un comentariu