Autor Beitrag
erdmulch
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: So 20.02.11 20:17 
Hallo zusammen,

kann mir jemand sagen wie man sowas in C# programmiert. hab leider nur mit Java erfahrung will aber c# lernen.
um es kurz zufassen es handelt sich um eine schnittstelle und um die Klasse Kreis10 die die Farbe erbt. ansonsten dürfte alles klar sein

danke im voraus

ausblenden volle Höhe C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
public interface InterfaceFlaeche
{
 public double getFlaeche();
}//public interface InterfaceFlaeche



public interface InterfaceUmfang
{
 public double getUmfang();
}//public interface InterfaceUmfang



public class Farbe10
{
 private int farbe;
 public void setFarbe(int farbe)
 {
   this.farbe = farbe;
 }//public void setFarbe(int farbe)
 public int getFarbe()
 {
   return this.farbe;
 }//public int getFarbe()
 }//public class Farbe10


public class Kreis10 extends Farbe10
 implements InterfaceFlaeche, InterfaceUmfang
 {
   private double radius;
   public void setRadius(double radius)
   {
     this.radius = radius;
   }//public void setRadius(double radius)
   public double getRadius()
   {
     return this.radius;
   }//public double getRadius()
   public double getFlaeche()
   {
     return Math.pow(this.radius , 2) * Math.PI;
   }//public double getFlaeche()
   public double getUmfang()
   {
     return 2 * this.radius * Math.PI;
   }//public double getUmfang()
 }//public class Kreis10 extends


Moderiert von user profile iconKha: C#-Tags hinzugefügt
Kha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3803
Erhaltene Danke: 176

Arch Linux
Python, C, C++ (vim)
BeitragVerfasst: So 20.02.11 21:27 
Was ist nun die Frage, die genaue Syntax? So etwas schlägt man am besten nach. Generell würde ich dir zum Umstieg aber umfassendere Literatur wie ein Buch empfehlen. Dann wirst du schnell sehen, dass get-Methoden in C# nichts verloren haben ;) .

PS: Hast du eigentlich noch vor, auf deine alten Threads zu antworten? Ein solches Verhalten erhöht nicht gerade die Antwortbereitschaft :| .

_________________
>λ=