This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: non-aggregate type problem
- From: "Stuart Brooks" <stuartb at cat dot co dot za>
- To: "Andre Kirchner" <supercroc1974 at yahoo dot com>,<gcc-help at gcc dot gnu dot org>
- Date: Fri, 23 Jul 2004 11:26:27 +0200
- Subject: Re: non-aggregate type problem
- Organization: Intervid Technologies
- References: <20040720221450.97668.qmail@web50510.mail.yahoo.com>
I think your SendHELO method should look like this... (note the "->")
int Sender::sendHELO()
{
theConnector->sendMessage( "HELO test" );
}
Regards
Stuart
----- Original Message -----
From: "Andre Kirchner" <supercroc1974@yahoo.com>
To: <gcc-help@gcc.gnu.org>
Sent: Wednesday, July 21, 2004 12:14 AM
Subject: non-aggregate type problem
> Hi,
>
> could someone please explain me the meaning of
> "request for member `sendMessage' in
> 'this->Sender::theConnector', which is of
> non-aggregate type `Connector*'"?
>
> In the following code I created an object Connector
> called theConnector. Then when I created an object
> Sender called theSender, I passed a pointer to
> theConnector as a parameter.
> I thought it would allow the to use theConnector
> object inside theSender, but for some reason it is not
> working.
>
> Thanks,
>
> Andre
>
> -------------------------------------------------
> main.cpp:
>
> #ifndef MAIN
> # define MAIN
> # include "main.h"
> #endif
>
> int main( int argc, char *argv[] )
> {
> char theMessage[ 256 ];
> Connector theConnector;
> Sender theSender( &theConnector );
>
> bzero( theMessage, 256 );
> theConnector.establishConnection( "65.54.252.99",
> 25 );
>
> theConnector.receiveMessage( theMessage, 255 );
> printf( "%s\n", theMessage );
>
> theSender.sendHELO();
> theConnector.receiveMessage( theMessage, 255 );
> printf( "%s\n", theMessage );
>
> theConnector.closeConnection();
>
> return ( EXIT_SUCESS );
> }
>
> ____________________________________________
> Sender.h:
>
> #ifndef STRING
> # define STRING
> # include <string.h>
> #endif
>
> #ifndef CONNECTOR
> # define CONNECTOR
> # include "Connector.h"
> #endif
>
> class Sender
> {
> public:
> Sender(){};
> Sender( Connector * newConnector );
> ~Sender(){};
> int setOrigin( const char * newOrigin );
> int setDestiny( const char * newDestiny );
> int setData( const char * newData );
> int sendHELO();
> int sendMAILFROM();
> int sendRCPT();
> int sendDATA();
>
> private:
> char theOrigin[ 256 ], theDestiny[ 256 ], theData[
> 256 ];
> Connector * theConnector;
> };
> _____________________________________________
> Sender.cpp:
>
> #ifndef SENDER
> # define SENDER
> # include "Sender.h"
> #endif
>
> int Sender::sendHELO()
> {
> theConnector.sendMessage( "HELO test" );
> }
>
> _________________________________________________
> Connector.h:
>
> class Connector
> {
> public:
> Connector(){};
> ~Connector(){};
> int establishConnection( const char *
> theMailServerName, int thePortNumber );
> int sendMessage( const char * theMessage );
> int receiveMessage( char * theMessage, int
> theMessageLength );
> int closeConnection();
>
> private:
> int sockfd;
> };
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>