Query on some code found within a struct

S

Simon2005

Hi,
This is a segement of code taken from Warren Young's FAQ on Winsock @
http://tangentsoft.net/wskfaq/

struct Connection {
SOCKET sd;
char acBuffer[kBufferSize];
int nCharsInBuffer;
Connection(SOCKET sd_) : sd(sd_), nCharsInBuffer(0) { }
};

Any idea what the second last line means? Is it an initialiser or
something?

Thanks,

Simon
 
A

Artie Gold

Simon2005 said:
Hi,
This is a segement of code taken from Warren Young's FAQ on Winsock @
http://tangentsoft.net/wskfaq/

struct Connection {
SOCKET sd;
char acBuffer[kBufferSize];
int nCharsInBuffer;
Connection(SOCKET sd_) : sd(sd_), nCharsInBuffer(0) { }
};

Any idea what the second last line means? Is it an initialiser or
something?

Thanks,

Simon
It's C++ code (`Connection()' is a constructor with initializers), hence
off-topic here.

HTH,
--ag
 
S

Simon2005

Thought it might be C++. But the struct keyword made me think
otherwise.

Anyways, thanks for the help.

Simon.
 
G

Goran Larsson

Simon2005 said:
Thought it might be C++. But the struct keyword made me think
otherwise.

But struct is the same as class in C++. The difference is only
if private or public is the default at the top of the struct/class.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,159
Messages
2,570,879
Members
47,417
Latest member
DarrenGaun

Latest Threads

Top