Roger Oberholtzer wrote:
What would be the equivalent functionality in g++? I am not a c++ programmer, so a concrete example is needed!
The C version of one use is this:
typedef struct {
const char *CMD_SERVICE, *CMD_TRANSPORT;
} dPavueCnfg;
dPavueCnfg dConfig = {
.CMD_SERVICE = "DPcmd", .CMD_TRANSPORT = "tcp"
};
What would I do in C++?
It's been about ten years since I did C++ regularly, but let's try:
your struct becomes a class
class xxxxxx {
public: const char *CMD_SERVICE, *CMD_TRANSPORT;
// constructor xxxxxxx( char *s, char *t):CMD_SERVICE(s),CMD_TRANSPORT(t) {}; }
When you instantiate the class:
xxxxxx dConfig ( "DPcmd", "tcp" );
/Per Jessen, Zürich