Re: Equals() and inheritance
- From: "Jon Skeet [C# MVP]" <skeet@xxxxxxxxx>
- Date: Mon, 26 Nov 2007 06:41:56 -0800 (PST)
On Nov 26, 2:16 pm, Alex Cohn <AlexC...@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
In C++, inheritance works through a virtual table. Each object refers to a
table of virtual functions. The overloaded Equals() for object of type B is
in the object's table. Therefore, even if the object is "known" to the
compiler as type A reference, the call will peform the B::Equals() call. I am
puzzled if C# resolves all overloads at compile time.
You're confusing overloading and overriding. Overriding is performed
at execution time, but overloading is performed at compile time. I
believe C++ works the same way.
Jon
.
- References:
- Equals() and inheritance
- From: Alex Cohn
- Re: Equals() and inheritance
- From: Jon Skeet [C# MVP]
- Equals() and inheritance
- Prev by Date: Re: How do you make a variable persist in memory?
- Next by Date: Re: Dispose(bool), Idisposable, form closing etc.
- Previous by thread: Re: Equals() and inheritance
- Next by thread: Re: Equals() and inheritance
- Index(es):
Relevant Pages
|