M
muler
Hi,
[Section 20.1 The C# Programming Language;Anders Hejlsberg, Scott
Wiltamuth, Peter Golde]
"
Generic types may not be "overloaded"; that is, the identifier of a
generic type must be uniquely named within a scope in the same way as
ordinary types.
class C {}
class C<V> {} // Error, C defined twice
class C<U,V> {} // Error, C defined twice
"
But I was unable to verify this using Microsoft Visual C# 2005, which
reports no error:
class Program
{
class C { }
class C<V> { } // no error reported
class C<U, V> { } // no error reported
static void Main(string[] args)
{
}
}
Is this an error in the book or something else?
Thanks!
Mulugeta.
[Section 20.1 The C# Programming Language;Anders Hejlsberg, Scott
Wiltamuth, Peter Golde]
"
Generic types may not be "overloaded"; that is, the identifier of a
generic type must be uniquely named within a scope in the same way as
ordinary types.
class C {}
class C<V> {} // Error, C defined twice
class C<U,V> {} // Error, C defined twice
"
But I was unable to verify this using Microsoft Visual C# 2005, which
reports no error:
class Program
{
class C { }
class C<V> { } // no error reported
class C<U, V> { } // no error reported
static void Main(string[] args)
{
}
}
Is this an error in the book or something else?
Thanks!
Mulugeta.