Zum Inhalt springen

Einzelne Statusmeldung

Zeige alle Statusmeldungen von Johnny Steeven

  1. Hallo, ich versuche gerade ein Programm zu schreiben aber bin noch ein Anfanger. Thema=Erben Kann man bitte mir sagen was bei dem Kopierkonstructor der erbende Klasse (Sache) falsch ist ? Hier ist das Programm: package Test; public class Tasche { private double grosse; public Tasche(double grosse){ this.grosse=grosse; } public Tasche(Tasche t){ //Kopierconstructor this.grosse=t.grosse; } public double Valeur(){ return grosse * 5; } } package Testi; import Test.Tasche; public class Sache extends Tasche { private double buch; private double heft; private Tasche t; public Sache(Tasche t , double buch , double heft){ super(t); this.t=t; this.buch=buch; this.heft=heft; } public Sache(Sache u ){ //Kopierkonstructor der Klasse Sache =>FEHLERMELDUNG this.t=new Tasche(u.t); this.buch=u.buch; this.heft=u.heft; } }

Fachinformatiker.de, 2024 by SE Internet Services

fidelogo_small.png

Schicke uns eine Nachricht!

Fachinformatiker.de ist die größte IT-Community
rund um Ausbildung, Job, Weiterbildung für IT-Fachkräfte.

Fachinformatiker.de App

Download on the App Store
Get it on Google Play

Kontakt

Hier werben?
Oder sende eine E-Mail an

Social media u. feeds

Jobboard für Fachinformatiker und IT-Fachkräfte

×
×
  • Neu erstellen...