forked from kiba518/CSharpClassicProgram
-
Notifications
You must be signed in to change notification settings - Fork 0
/
unknown.txt
61 lines (58 loc) · 1.25 KB
/
unknown.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using System;
namespace dirtysalt
{
public class Car//class of car,has attribute of 'weight' and 'speed'
{
private int weight;
private int speed;
public Car(int Weight,int Speed)
{
weight=Weight;
speed=Speed;
}
public void setweight(int Weight)
{
weight=Weight;
}
public void setspeed(int Speed)
{
speed=Speed;
}
public int getspeed()
{
return speed;
}
public int getweight()
{
return weight;
}
};
public class Sportcar:Car//inherit class of Car,has attributes of 'weight','speed','color'
{
private string color;
public Sportcar(int Weight,int Speed,string Color):base(Weight,Speed)
{
setweight(Weight);
setspeed(Speed);
color=Color;
}
public void setcolor(string Color)
{
color=Color;
}
public string getcolor()
{
return color;
}
public static void Main()
{
Car car=new Car(100,100);
Sportcar sportcar=new Sportcar(100,200,"blcak");//here has a problem
Console.WriteLine("car's weight is "+car.getweight());
Console.WriteLine("car's speed is "+car.getspeed());
Console.WriteLine("sportcar's weight is "+sportcar.getweight());
Console.WriteLine("sportcar's speed is "+sportcar.getspeed());
Console.WriteLine("sportcar's speed is "+sportcar.getcolor());
}
}
}