Verständnisfrage zu Try Catch



  • Ich hab nochmal etwas dran gearbeitet, aber die Fehlermeldungen bleiben.

    Soweit bin ich bis jetzt:

    .h-Datei:

    #pragma once
    
    ref class dbwrap
    {
    	System::Collections::Generic::List<System::String ^> ^dbBundesland;
    	System::Collections::Generic::List<int> dbRang, dbAktData;
    	System::Collections::Generic::List<float> dbEinwohner;
    
    public:
    
    	ref class Proxy
    	{
    		dbwrap ^haupt;
    		int index;
    
    	public:
    		Proxy(dbwrap ^, int);
    
    		property System::String ^Bundesland
    		{
    			System::String ^ get()
    			{
    				return haupt->dbBundesland[index];
    			}
    			void set(System::String ^s)
    			{
    				haupt->dbBundesland[index] = s;
    			}
    		}
    
    		property int Rang
    		{
    			int get()
    			{
    				return haupt->dbRang[index];
    			}
    			void set(int i)
    			{
    				haupt->dbRang[index] = i;
    			}
    		}
    
    		property float Einwohner
    		{
    			float get()
    			{
    				return haupt->dbEinwohner[index];
    			}
    			void set(float f)
    			{
    				haupt->dbEinwohner[index] = f;
    			}
    		}
    
    		property int CountDB
    		{
    			int get()
    			{
    				return haupt->dbAktData[index];
    			}
    			void set(int i)
    			{
    				haupt->dbAktData[index] = i;
    			}
    		}
    
    		property Proxy default[int]
    		{
    			Proxy ^get(int i)
    			{
    				return gcnew Proxy(this,i);
    			}
    
    		void set(dbwrap ^h ,int i)
    			{
    				for(y = 0; y<i+1; y++)
    				{
    					haupt[i] = h[i];
    				}			
    
    			}
    		}
    
    	};
    }
    

    .cpp Datei:

    #include "StdAfx.h"
    #include "dbwrap.h"
    
    dbwrap::Proxy::Proxy(dbwrap ^ h, int i) : haupt(h), index(i)
    	{
    
    	}
    

    Fehlermeldungen:

    1>------ Erstellen gestartet: Projekt: DB_Editor2, Konfiguration: Debug Win32 ------
    1>Kompilieren...
    1>dbwrap.cpp
    1>c:\users\matten\documents\visual studio 2008\projects\db_editor2\db_editor2\dbwrap.h(73) : error C3901: "get": Muss den Rückgabetyp "dbwrap::Proxy" aufweisen.
    1>c:\users\matten\documents\visual studio 2008\projects\db_editor2\db_editor2\dbwrap.h(78) : error C3902: "set": Der Typ des letzten Parameters muss "dbwrap::Proxy" sein.
    1>c:\users\matten\documents\visual studio 2008\projects\db_editor2\db_editor2\dbwrap.h(78) : error C2192: Parameterdeklaration '1' ist unterschiedlich
    1>c:\users\matten\documents\visual studio 2008\projects\db_editor2\db_editor2\dbwrap.h(86) : error C3903: "dbwrap::Proxy::default": Hat keine set-Methode oder get-Methode.
    1>.\dbwrap.cpp(5) : error C2533: 'dbwrap::Proxy::{ctor}': Ergebnistyp für Konstruktoren nicht zulässig
    1>Das Buildprotokoll wurde unter "file://c:\Users\Matten\Documents\Visual Studio 2008\Projects\DB_Editor2\DB_Editor2\Debug\BuildLog.htm" gespeichert.
    1>DB_Editor2 - 5 Fehler, 0 Warnung(en)
    ========== Erstellen: 0 erfolgreich, Fehler bei 1, 0 aktuell, 0 übersprungen ==========

    Es muss was mit den get und set methoden des default indexers zu tun haben, aber ich komm leider nicht drauf was das Problem ist. Ebenso versehe ich nicht, warum die Parameterdeklaration 1 (der int index) unterschiedlich sein soll.

    Vielleicht hat mir jemand noch einen Hinweis?

    GRuß Solick


Anmelden zum Antworten