A
Andy Read
Greetings all,
I'm currently reading the excellent applied .Net Framework programming
by Jeffrey Ritcher. In the Type Fundamentals chapter a brief description of
the System.Object methods is given.
Against the GetType member it says: This method is nonvirtual preventing
classes from overriding the method and lying about its type, violating type
safety.
This all seems to make prefect sense. But... you could 'Shadow' the GetType
function in a class and return a completely different type. Does this not
violate type safety? If not could someone please explain?
Many Thanks
Andy Read.
I'm currently reading the excellent applied .Net Framework programming
by Jeffrey Ritcher. In the Type Fundamentals chapter a brief description of
the System.Object methods is given.
Against the GetType member it says: This method is nonvirtual preventing
classes from overriding the method and lying about its type, violating type
safety.
This all seems to make prefect sense. But... you could 'Shadow' the GetType
function in a class and return a completely different type. Does this not
violate type safety? If not could someone please explain?
Many Thanks
Andy Read.