If reference in C++ is just an alias to an existing variable, why does it have same size as pointer? If they are implemented like pointers only then why creating a separate topic?
struct a{
int x;
int &y=x;
};
In this scenario sizeof(a) turns out to be 8 which tries to say that y is taking extra memory for itself.
Which of them is actually fast or both of them consume same time? Which of these concepts is then moved to Java and is closely related to references in Java?