k_chen
asked on
Unions?
Union is not possible in Visual Basic, I think, how do you get around this then?
Strike.
ASKER
Please, serious answers please.
The closest thing we have to unions is the user defined type. Kind of like saying the closest we have to a battleship is a rubber duck.
Sorry, humour goes with the territory.
Sorry, humour goes with the territory.
In C++:
Union {
float f;
int n;
} UDF
In VB:
Type UDF
f As Single
n As Integer
End Type
Union {
float f;
int n;
} UDF
In VB:
Type UDF
f As Single
n As Integer
End Type
Also, unnamed UDTs are not allowed.
Could you be referring to UNION not existing in Access SQL?
ASKER
I'm referring to union as how ClifABB described it in C++. Not the SQL command. Another question on Visual Basic's flaw. I don't think it's possible to declare constants in Type Declartion, is it?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
By the way...
I've been pondering this all night. Why would anyone want to declare a constant in a union, struct, or UDT? It's a very inefficient use of memory. Every time you construct using the union you would be creating a new copy of the constant, when a single constant, declared globally, would be much more efficient.
I've been pondering this all night. Why would anyone want to declare a constant in a union, struct, or UDT? It's a very inefficient use of memory. Every time you construct using the union you would be creating a new copy of the constant, when a single constant, declared globally, would be much more efficient.
ASKER
I think the point of having a constant in a UDT is to encapsulate data objects. You're right, it does not have any merit from efficiency point of view.