Friday, July 9, 2010

static const QString

Java allows to define constant Strings as
public final static String SIZE = "size";
in your .java files.

To define static const QString members for a class in c++ environment,
put your static const QString member into related .h file.
Constants.h
class QString;
class Constants{
public:
 static const QString xmlBaseFolderPath;
};

Add related initialization of the static member into .cpp file.
Constants.cpp
#include "Constants.h"
#include <QString>
const QString Constants::xmlBaseFolderPath = "C:\\XML";

No comments:

Post a Comment