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; ...
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; ...
"Think not but that I know these things; or think
I know them not: not therefore am I short
Of knowing what I ought."
-John Milton, Paradise Regained (1671)
"Work hard and it might happen."
-XSquared
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
Compilers:
GCC on Red Hat 8.1 (Primary)
GCC on Mac OS X 10.2.4 (Secondary)
Others:
MinGW on XP
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;
Last edited by 7stud; 04-29-2003 at 10:09 PM.
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;
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law