inaccessible



  • Hallo nochmal!
    Habs jetzt erstmal soweit das es lief, aber jetzt bei der ausgabe kommt folgende Fehlermeldung:

    "char*Kran::Typ' is inaccessible within this content."
    Hab mal die Markierungen mit angegeben.(Habs mit einer # bzw. ## markiert.)

    Ich weiß wirklich nicht weiter und habe auch nich so den plan vom programmieren, aber muss bis morgen einen wichtigen beleg abgeben.

    danke im voraus
    gruß stuff

    #include <iostream>
    using namespace std;
    
    class Bestand
          {      
                 public:    long Nr;
                            char *Gst;
                            double Wert;
          };
    
    class Kran
          {      
    #             public: # char *Typ;         
                            char *Fa;
                            char *Leas;
                            double NKost;
    
                            Kran (char *Krantyp = "AK-30",
                                  char *Firma  = "Allkran",
                                  char *Leasing = "ja",
                                  double NebenKost = 50.7)
    
                                  { 
                                         Typ = Krantyp;
                                         Fa  = Firma;
                                         Leas = Leasing;
                                         NKost = NebenKost;
                                   };
    
                            ~Kran(){}
           };
    
    class Verkauf : public Bestand, Kran
          {      
                 public:   Verkauf (long nr = 1015,
                                    char *Gegenstand = "Autokran",
                                    double wert = 132000,
                                    char *Krantyp = "AKX-35",
                                    char *Firma = "Werner")
    
                                    {    Nr = nr;
                                         Gst = Gegenstand;
                                         Wert = wert;
                                         Typ = Krantyp;
                                         Fa = Firma;
                                     };
    
                            ~Verkauf(){}
                            double V_Preis();
          };
    
    double Verkauf::V_Preis()
           {
                 double VP;
                 VP = (Wert + (Wert * NKost)/100)*0,16;
                 return VP;
           };
    
    class Sonderpreis : public Verkauf
          {      
                 protected:    double Sond;
    
                 public:       double SPr();
    
                               Sonderpreis (double sond = 12)
                                     {
                                           Sond = sond;
                                     };
    
                               ~Sonderpreis(){}
          };
    
    double Sonderpreis::SPr()
           {
                  double Preis;
                  Preis = Verkauf::V_Preis();
                  Preis = (1-(Sond/100))*Preis;
                  return Preis;
           };
    
    void main()
         {
               double P;
    
               class Sonderpreis SO1;
               SO1.Nr = 10024;
               SO1.Wert = 123000;
    ##     ##  SO1.Typ = "AK-30";
               SO1.Fa = "Allkran";
               SO1.NKost = 50.7;
    
               cout << "\n Nr.: "          << SO1.Nr;
               cout << "\n Gegenstand: "   << SO1.Gst;
               cout << "\n Wert: "         << SO1.Wert;
               cout << "\n Typ: "          << SO1.Typ;
               cout << "\n Firma: "        << SO1.Fa;
               cout << "\n Leasing: "      << SO1.Leas;
               cout << "\n Nebenkosten: "  << SO1.NKost;
    
               }
    


  • stuff schrieb:

    "char*Kran::Typ' is inaccessible within this content."

    class Verkauf : public Bestand, Kran
    

    Du erbst, wenn du nichts anderes angibst, privat von Kran, d.h. alles was in Kran public war, ist in Verkauf privat. Lösung:

    class Verkauf: public Bestand, public Kran
    


  • vielen dank...


Anmelden zum Antworten