Okay Referenzen übergebe ich ja normalerweise mit z.B konstruktor(&referenz)
.
Wie soll ich das denn hier anstellen:confused:
Bisher sieht meine Klasse ungefähr so aus:
Connect.h
#pragma once
#include <afx.h>
#include <afxwin.h>
#include <afxinet.h>
class Connect
{
public:
Connect(void);
static CFtpConnection * Connect::getLastConnection();
static CFtpConnection *connection_pointer;
~Connect(void);
};
Connect.cpp:
CFtpConnection Connect::*connection_pointer=0;
CFtpConnection* Connect::connection_pointer=NULL;
CInternetSession session((_T("My FTP Session")),1, INTERNET_OPEN_TYPE_PROXY ,
(_T( "proxy")), NULL, 0);
Connect::Connect(void)
{
try
{
//FTP-Verbindung wird eröffnet,Methode GetFtpConnection wird auf session angewandt,
//connection wird auf zurückgegeben Zeiger gesetzt
if(connection_pointer = session.GetFtpConnection(pstrServer, login, passwd, port, bPassive))
{
cout << "Verbindung wurde aufgebaut\n";
}
}
//Fehleroutine
catch (CInternetException* pEx)
{
cout<<"FEHLER : "<<GetLastError()<<endl;
TCHAR sz[1024];
pEx->GetErrorMessage(sz, 1024);
printf_s("ERROR! %S\n", sz);
pEx->Delete();
}
cout << "Test Konstruktor von Connect erfolgreich\n";
// if the connection is open, close it
if (connection_pointer != NULL)
{
connection_pointer->Close();
//delete connection_pointer;
}
}