Skip to content

Commit ff99958

Browse files
committed
Final questions of exam #2
1 parent 0788b28 commit ff99958

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

source/solutions/oop/inheritance.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@ tags:
6969
- [x] Need to be inside an `abstract` class
7070
- [x] Not be overriden
7171

72+
#. A method …
73+
74+
- [ ] … can be accessed from any class if it is marked `protected`.
75+
- [ ] … can be accessed from its derived classes if it is marked `private`.
76+
- [ ] … is recursive if it terminates.
77+
- [x] … is recursive if it calls itself.
78+
- [x] … must be overridden if it is marked `abstract`.
79+
- [ ] … cannot be overriden if it is marked `sealed`.
80+
7281
#. Give at least two differences between an abstract class and an interface.
7382

7483
<details><summary>Solution</summary>

source/solutions/oop/references.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,22 @@ tags:
5353
- [ ] The keyword `out` cannot be used in the header of a method.
5454
- [ ] An `out` parameter cannot be assigned a value.
5555

56+
#. A method is forced to set the value of an `int` argument `c` passed as a reference, if it has…
57+
58+
- [x] … `out int c` in its header
59+
- [ ] … `int out c` in its header
60+
- [ ] … `ref int c` in its header
61+
- [ ] … `int ref c` in its header
62+
63+
#. A method with header `public virtual void Test(int a, ref int b)` will…
64+
65+
- [ ] Return a value
66+
- [ ] Set the value of `a`
67+
- [ ] Set the value of `b`
68+
- [x] Assume that `a` has a value
69+
- [x] Assume that `b` has a value
70+
- [ ] Be impossible to override
71+
5672
## Warm-up Exercises
5773

5874
#. Consider the following code:

0 commit comments

Comments
 (0)