You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/lectures/oop/polymorphism.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ This means that the following code is valid:
39
39
Note, however, that
40
40
41
41
-`object1.Property2 = "Test";` would not compile, since an object from `Class1` cannot access the attributes, properties and methods of `Class2`.
42
-
-`ClassHelper.Method2(object1);` would also not compile, since an object from `Class1` cannot "become" an object of `Class2`.
42
+
-A method requiring an argument of type `Class2` would *not* accept `object1` as an argument, since an object from `Class1` cannot "become" an object of `Class2`.
43
43
44
44
Stated differently, an object in `Class2`*is a(n object in)*`Class1`, but the converse is not true: an object in `Class1`*is not* an object in `Class2`.
Copy file name to clipboardExpand all lines: source/solutions/oop/inheritance.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,29 +40,29 @@ tags:
40
40
41
41
#. Consider the diagram representing the "Room", "ClassRoom", "Office" classes and their relations.
42
42
43
-
!include diag/cla/RoomClassroomOffice.md
43
+
!include diag/cla/RoomClassroomOffice.md
44
44
45
-
Suppose you are given an implementation of the `Room` class, such that
45
+
Suppose you are given an implementation of the `Room` class, such that
46
46
47
-
```
48
-
!include`snippetStart="// Question 1",snippetEnd="// Refer to Classroom.cs for a solution"` code/projects/RoomClassroomOffice/RoomClassroomOffice/Program.cs
49
-
```
47
+
```
48
+
!include`snippetStart="// Question 1",snippetEnd="// Refer to Classroom.cs for a solution"` code/projects/RoomClassroomOffice/RoomClassroomOffice/Program.cs
49
+
```
50
50
51
-
displays
51
+
displays
52
52
53
-
```text
54
-
UH 243
55
-
```
53
+
```text
54
+
UH 243
55
+
```
56
56
57
-
#. Write an implementation of the `ClassRoom` class. Your `ToString` method should display the room's building and number, in addition to whether it has AV set-up.
57
+
#. Write an implementation of the `ClassRoom` class. Your `ToString` method should display the room's building and number, in addition to whether it has AV set-up.
#. Write a `SameBuilding` static method to be placed inside the `Room` class such that
65
+
#. Write a `SameBuilding` static method to be placed inside the `Room` class such that
66
66
67
67
```
68
68
!include`snippetStart="// Question 2",snippetEnd="// Refer to Room.cs for a solution.",dedent=4` code/projects/RoomClassroomOffice/RoomClassroomOffice/Program.cs
0 commit comments