|
-
Jun 13th, 2004, 10:54 PM
#1
Thread Starter
Lively Member
Questions about the member of the structure.
The code below is a part of the select-server.cpp from the www.tangentsoft.net/wskfaq. I don't understand what is this line
'Connection(SOCKET sd_) : sd(sd_), nCharsInBuffer(0) { }' in the Connection structure.
struct Connection {
SOCKET sd;
char acBuffer[kBufferSize];
int nCharsInBuffer;
Connection(SOCKET sd_) : sd(sd_), nCharsInBuffer(0) { } // What is this?
};
typedef vector<Connection> ConnectionList;
ConnectionList gConnections;
Last edited by tommeal; Jun 13th, 2004 at 10:57 PM.
-
Jun 14th, 2004, 07:19 AM
#2
Fanatic Member
It's a constructor - a struct in c++ can have functions too. The constructor here is initialising the sd member with the parameter passed to it, and initialising the nCharsinBuffer member with zero.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|