AS和C++的反射机制比较
所谓反射机制(Reflection),简单来说就是根据类的名称获取类及其对应的实例。 具体来说,我们可以在运行时加载、检测和使用在编译时完全未知的类。 换句话说,程序可以加载一个名称仅在运行时知道的类,了解其完整结构(但不了解其方法定义),并生成其对象实体,或为其字段设置值,或调用其方法。as 语言本身支持反射机制,而 C++ 不支持。
现在的问题是,as如何实现底层的反射机制?
(The so-called reflection mechanism is simply to obtain the class and its corresponding instances according to the name of the class. Specifically, we can load, detect and use classes at run time that are completely unknown at compile time. In other words, a program can load a class whose name is only known at run time, understand its complete structure (but not its method definition), and generate its object entity, or set values for its fields, or call its methods.
As language itself supports reflection mechanism, but C + + does not.
The question now is, how does as implement the underlying reflection mechanism?
)
页:
[1]