Skip to content

Commit d5cb445

Browse files
committed
Minor fixes.
1 parent 8657b92 commit d5cb445

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

source/solutions/oop/inheritance.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ tags:
7676
- [ ] … is recursive if it terminates.
7777
- [x] … is recursive if it calls itself.
7878
- [x] … must be overridden if it is marked `abstract`.
79-
- [ ] … cannot be overriden if it is marked `sealed`.
79+
- [x] … cannot be overriden if it is marked `sealed`.
8080

8181
#. Give at least two differences between an abstract class and an interface.
8282

@@ -255,6 +255,8 @@ tags:
255255
```{download="code/projects/Shapes.zip"}
256256
!include`snippetStart="// Diameter property",snippetEnd="// Rest of the class"` code/projects/Shapes/Shapes/Circle.cs
257257
```
258+
259+
The `set` is missing because `Diameter` must be at all time be equal to `Radius` times 2. There is no point in storing the diamater separately, since this information can be recovered, and since storing it would require to change the value of `Radius` every time it is updated.
258260
</details>
259261
260262
#. Write an implementation for the `ToString` method of the `Rectangle` class that returns a `string` containing what was returned by the `Shape`'s `ToString` method, the width, length and area of the calling object. For example, for a `Rectangle` with width 10 and length 5, it should be of the form "This shape is a rectangle (W: 10, L: 5, Area: 50)".

0 commit comments

Comments
 (0)