Become a sponsor to access source code ► / zoranhorvat
Join Discord server with topics on C# ► https://codinghelmet.com/go/discord
Enroll course Beginning Object-Oriented Programming with C# ► https://codinghelmet.com/go/beginning...
Subscribe ► / @zoran-horvat
Do you know how C# knows which implementation of a virtual method to execute when you make a call to it? First, it is not C# - it is the .NET Runtime who decides. But that is the lesser problem. The question remains: How does .NET Runtime know which implementation to execute when you make a call to a virtual method on an object?
We ask the same question about .NET Reflection, too. How does the GetType() method know the right type object to return when we call it on a reference to its base type? Such a confusion!
This video dives into the structure of every instance of every reference type in .NET. You will learn about the type descriptor and the table of virtual methods - two fundamental traits of every object you instantiate. By understanding how method resolution works during run time, you will know everything about virtual methods in .NET and C# and any other object-oriented language, all the same.
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
⚡️RIGHT NOTICE:
The Copyright Laws of the United States recognize a “fair use” of copyrighted content. Section 107 of the U.S. Copyright Act states: “Notwithstanding the provisions of sections 106 and 106A, the fair use of a copyrighted work, including such use by reproduction in copies or phono records or by any other means specified by that section, for purposes such as criticism, comment, news reporting, teaching (including multiple copies for classroom use), scholarship, or research, is not an infringement of copyright." This video and our youtube channel, in general, may contain certain copyrighted works that were not specifically authorized to be used by the copyright holder(s), but which we believe in good faith are protected by federal law and the Fair use doctrine for one or more of the reasons noted above.
#csharp #dotnet #objectorientedprogramming