什么是c#中的动态调度机制? [英] what is dynamic dispatch mechanism in c# ?

查看:82
本文介绍了什么是c#中的动态调度机制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是c#中的动态调度机制?在c#中使用抽象类程序意味着我们是动态调度,而不是静态调度。你能用一些简单的例子来解释吗

解决方案

使一些类摘要与动态或静态调度无关。形式上,这是一个纯粹的语法设备,用于防止类实例化,没有别的。您可以没有抽象类,但仍然具有动态调度。您可以创建一些抽象类并且没有动态调度,或者在更荒谬的情况下,根本没有调度(与这些类相关)。



调度注意事项是首先,与虚拟功能相关。询问机制和各种调度的用途与询问OOP如何工作?相同。首先要知道的是C#(和.NET)使用主流的面向对象技术;所以你可以了解它的工作原理,特别是与C#无关。您可以查看整个主题:

https://en.wikipedia.org/wiki/Object -oriented_programming [ ^ ],
https://en.wikipedia.org/wiki/Virtual_function [ ^ ],

https://en.wikipedia.org/wiki/Dynamic_dispatch [ ^ ]。



我不知道这里需要什么解释。也许,首先,你需要学习编程本身,而不仅仅是编程。其中一个最重要的组成部分是通过编写代码并了解其工作原理来尝试所有的实践效果和机制。



-SA


静态/动态调度 - 重新解释 [ ^ ]

what is dynamic dispatch mechanism in c# And Using Abstract Class In c# Program Mean We Are Dispatching Dynamically , Not Static . Can You Explain It With Some Easy Example

解决方案

Making some class abstract has nothing to do with dynamic or static dispatch. Formally, this is a pure syntactic device used to prevent class instantiation, nothing else. You can have no abstract classes and still have dynamic dispatch. You can create some abstract classes and have no dynamic dispatch, or, in even more ridiculous cases, no dispatch (related to those classes) at all.

Dispatch considerations are related, first of all, to virtual functions. Asking about mechanism and the uses of kinds of dispatch is the same as asking "how OOP works?" First thing to know is that C# (and .NET) uses mainstream object-oriented technology; so you can learn how it works in general, not related to C# specifically. You can review the whole topic:
https://en.wikipedia.org/wiki/Object-oriented_programming[^],
https://en.wikipedia.org/wiki/Virtual_function[^],
https://en.wikipedia.org/wiki/Dynamic_dispatch[^].

I don't know what needs explanations here. Perhaps, first of all, you need to learn programming itself, not just talks about programming. And one most important component of it is trying out all effects and mechanism on practice, by writing code and getting to understanding of how it works.

—SA


Static/Dynamic Dispatch - ReExplained[^]


这篇关于什么是c#中的动态调度机制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆