Slimelite BBS

Initializing Reference Member

Back to EMULATE

From Doug Nazar · 1996-04-09 08:49 · #73676 in EMULATE

Hello Adedayo!

Monday April 08 1996 23:33, Adedayo Taylor wrote to All:

AT> Can someone please let me know how to initialize a reference
AT> identifier, nothing I've tried so far gets rid of the "reference
AT> identifier not initialized" error.  My class looks something
AT> like this:

You need to add it to the constructor's initialization list like so:

class X : public Base
{
public:
    X(int & _YRef);
    ~X();
    int & YRef;
};

X::X(int & _YRef) : YRef(_YRef) {
   // other stuff here
}


Doug

--- GoldED/2 2.50+
 * Origin: Realm of the Dragons - `Where thy mind hath no limits' (1:250/516)