Is it possible to reference a class?
I was thinking something like this?
It's not really important. I just wanted to know...Code:
class classOne
{
...
};
class &classOneRef = classOne;
...
Printable View
Is it possible to reference a class?
I was thinking something like this?
It's not really important. I just wanted to know...Code:
class classOne
{
...
};
class &classOneRef = classOne;
...
Yes, i do believe you can. How else would you be able to pass a class reference to a function that takes a void*? I may, however, be wrong. It wouldn't be the first time.
~Inquirer
That sure doesn't look right to me. A reference to the keyword class?
"How else would you be able to pass a class reference..."
Like this?
class classOne
{
...
};
classOne a;
classOne& b = a;
You could do a typedef:
A variable of otherClassName is then the same as one of className. A variable of classNameRef is a reference to an object of className.Code:class className {
// ...
};
typedef className otherClassName;
typedef className &classNameRef;