Codice PHP:
#include <string>

class GEntity{
    private:
    const 
std::string &fConstStringRef;
    const 
std::string fConstString;
    
std::string fString1;
    
std::string fString2;
    
std::string fDefaultString;
    
std::string fString3;
    
    public:
    
GEntity (const std::string &theString);
};

GEntity::GEntity (const std::string &theString):
fConstStringRef (theString),
fConstString (theString),
fString1 (theString),
fString3 ("tre"){    
    
// sono gia' stati chiamati i costruttori di default di fString2 e fDefaultString.
    
fString2 theString
}

int main (void){
    
std::string aString ("Hello World!");
    
GEntity aEntity (aString);