Skip to content

Commit

Permalink
Fixing exercise.
Browse files Browse the repository at this point in the history
  • Loading branch information
aubertc committed Oct 15, 2024
1 parent cc40ce4 commit 4868318
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
10 changes: 6 additions & 4 deletions source/code/projects/RectangleReferences/Rectangle/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ class Program
{
static void Main(string[] args)
{

Rectangle r0 = new Rectangle(3, 2);

r0.Draw();
r0.Draw('-');

Rectangle original;
original = new Rectangle(5, 10);
Rectangle copy = original.Copy();
Expand All @@ -26,10 +32,6 @@ static void Main(string[] args)
+ "\nr1 and r5 identical: " + r1?.Equals(r5)
);

Rectangle r0 = new Rectangle(3, 2);

r0.Draw();
r0.Draw('%');

}
}
10 changes: 7 additions & 3 deletions source/exercises/oop/references.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ tags:
- datatypes
---

# Manipulating Objects and References

[Solutions for those exercises.](./exercises_w_sol/oop/references)

## Problem

Consider the "regular" implementation of the `Rectangle` class:
Expand Down Expand Up @@ -59,7 +63,7 @@ If your method is correctly implemented, then
Rectangle r0 = new Rectangle(3, 2);

r0.Draw();
r0.Draw('%');
r0.Draw('-');
```

should display
Expand All @@ -68,8 +72,8 @@ If your method is correctly implemented, then
***
***

%%%
%%%
---
---
```


Expand Down
8 changes: 5 additions & 3 deletions source/exercises_w_sol/oop/references.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ tags:
- datatypes
---

# Manipulating Objects and References

## Problem

Consider the "regular" implementation of the `Rectangle` class:
Expand Down Expand Up @@ -53,7 +55,7 @@ If your method is correctly implemented, then
Rectangle r0 = new Rectangle(3, 2);

r0.Draw();
r0.Draw('%');
r0.Draw('-');
```

should display
Expand All @@ -62,8 +64,8 @@ If your method is correctly implemented, then
***
***

%%%
%%%
---
---
```

<details><summary>Solution</summary>
Expand Down

0 comments on commit 4868318

Please sign in to comment.