declaration with typedef
David Nadlinger
see at klickverbot.at
Tue Dec 28 09:42:51 PST 2010
On 12/28/10 2:09 AM, Stanislav Blinov wrote:
> I don't think I got what David meant with it either. Assigning instances
> of the same type is perfectly valid as long as you do not define some
> very peculiar opAssign.
The point here is that person1 and person2 are not instances of the same
type, try compiling the following snippet:
---
struct Human {
string name;
int age;
}
void main() {
Human person1;
typedef Human Mankind;
Mankind person2 = person1;
}
---
This might not be what Hamad wanted to know when he asked »but why that
code works«, but I could think of no other reason why the snipped he
posted should fail to compile.
David
More information about the Digitalmars-d-learn
mailing list