【转载】#349 - The Difference Between Virtual and Non-Virtual Methods
2014-03-11 20:59
411 查看
In C#, virtual methods support polymorphism, by using a combination of the virtual and override keywords. With the virtual keyword on the base class method and the override keyword on the method in the derived class, both methods are said to be virtual.
Methods that don't have either the virtual or override keywords, or that have the new keyword, are said to be non-virtual.
When a virtual method is invoked on an object, the run-time type of the object is used to determine which implementation of the method to use.
When a non-virtual method is invoked on an object, the compile-time type of the object is used to determine which implementation of the method to use.
原文地址:#349 - The Difference Between Virtual and Non-Virtual Methods
Methods that don't have either the virtual or override keywords, or that have the new keyword, are said to be non-virtual.
When a virtual method is invoked on an object, the run-time type of the object is used to determine which implementation of the method to use.
When a non-virtual method is invoked on an object, the compile-time type of the object is used to determine which implementation of the method to use.
原文地址:#349 - The Difference Between Virtual and Non-Virtual Methods
相关文章推荐
- What is the difference between procedural and nonprocedural language?
- SharePoint : The difference and relation between SPListItem.Update and SPListItem.SystemUpdate Methods 【转载】
- SharePoint : The difference and relation between SPListItem.Update and SPListItem.SystemUpdate Methods 【转载】
- The difference between Process and Procedure
- The difference between 'typedef' and '#define'
- The difference between Git and SVN
- What’s the difference between a stack and a heap?
- Is punishment necessary to help children learn the difference between right and wrong?
- Differences Between the Import and Load Utility
- Self Summary: Lua Language(two useful links) and the difference between : and .
- http://stackoverflow.com/questions/10660721/what-is-the-difference-between-httpresponsemessage-and-httpresponseexception
- What are the difference between DDL, DML and DCL commands?
- The difference between major and minor version in sharepoint
- What is the difference between AWT and SWT?
- What is the difference between user level threads and kernel level threads?
- JMS: The difference between Message Acknowledgement and Transacted Session
- what's the difference between Rlock and Lock?
- The Differences Between BSD and System V Unix
- Learn the difference between SCSI and IDE
- The differences between BLOB and TEXT