Skip to content

Commit 387f012

Browse files
Anpassung Bezeichnung an vorheriges Beispiel, return ergänzt (#113)
1 parent 39b4700 commit 387f012

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

08_OOPGrundlagenII.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,20 +1133,20 @@ dessen Länge manipulieren.
11331133

11341134
```csharp
11351135
// Es müssen beide Varianten implementiert werden!
1136-
public static Point operator *(Point p1, double ratio)
1136+
public static Vector operator *(Vector p1, double ratio)
11371137
{
1138-
new Point(p1.X * ratio, p1.Y * ratio);
1138+
return new Vector(p1.X * ratio, p1.Y * ratio);
11391139
}
11401140

1141-
public static Point operator *(int ratio, Point p1)
1141+
public static Vector operator *(int ratio, Vector p1)
11421142
{
1143-
new Point(p1.X * ratio, p1.Y * ratio);
1143+
return new Vector(p1.X * ratio, p1.Y * ratio);
11441144
}
11451145

11461146
static void Main(string[] args)
11471147
{
1148-
Point ptOne = new Point(100, 100);
1149-
Point ptTwo = new Point(40, 40);
1148+
Vector ptOne = new Vector(100, 100);
1149+
Vector ptTwo = new Vector(40, 40);
11501150
}
11511151
Console.WriteLine((ptOne * 2.5));
11521152
Console.WriteLine((1 * ptOne));

0 commit comments

Comments
 (0)