g9:uebungen:konstruktoren:start
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende Überarbeitung | |||
g9:uebungen:konstruktoren:start [2022/06/30 07:41] – [Beispiel 2: Buntstift] Martin Pabst | g9:uebungen:konstruktoren:start [2022/06/30 07:43] (aktuell) – [Das Schlüsselwort "this"] Martin Pabst | ||
---|---|---|---|
Zeile 118: | Zeile 118: | ||
<div class=" | <div class=" | ||
<script type=" | <script type=" | ||
- | Buntstift rotstift = new Buntstift(Color.red); | + | Buntstift rotstift = new Buntstift(0xff0000); |
rotstift.schreibe(" | rotstift.schreibe(" | ||
class Buntstift { | class Buntstift { | ||
- | Color farbe; | + | int farbe; |
- | | + | |
farbe = farbe; | farbe = farbe; | ||
} | } | ||
Zeile 147: | Zeile 147: | ||
farbe = farbe; | farbe = farbe; | ||
</ | </ | ||
- | in Zeile 9, dass der Wert des Parameters '' | + | in Zeile 9, dass der Wert des Parameters '' |
Wir müssen dem Compiler irgendwie mitteilen, dass der Bezeichner '' | Wir müssen dem Compiler irgendwie mitteilen, dass der Bezeichner '' | ||
<code learnj> | <code learnj> | ||
Zeile 156: | Zeile 156: | ||
<div class=" | <div class=" | ||
<script type=" | <script type=" | ||
- | Buntstift rotstift = new Buntstift(Color.red); | + | Buntstift rotstift = new Buntstift(0xff0000); |
rotstift.schreibe(" | rotstift.schreibe(" | ||
class Buntstift { | class Buntstift { | ||
- | Color farbe; | + | int farbe; |
- | | + | |
this.farbe = farbe; | this.farbe = farbe; | ||
} | } |
g9/uebungen/konstruktoren/start.1656567719.txt.gz · Zuletzt geändert: 2022/06/30 07:41 von Martin Pabst