Sound designer/Game Developer based in South Yorkshire, UK

Report content RSS feed c++ Constructor initialization, reference

Posted by on

c++

int x
int* px = &x;
int& y = *px;

//y is now an int pointing to exactly the same data as x

initialisation list:-

class aclass
{
public:
    const int intvalue;
    const int intvalue2;
 
    aclass() : intvalue(23),intvalue2(25)//constructor
    {
     //stuff - intvalue = 23, but it could not be set here!
    }
};

c++ ref

int x = 9;
int &y = x;
Post a comment

You are not logged in, your comment will be anonymous unless you join the community. Or sign in with your social account:

Level
Avatar
Avatar
Last Online
Country
United Kingdom United Kingdom
Gender
Male
Friends
Become friends
Member watch
Start tracking
Blog
Browse
Blogs
Share