博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
class-metaclass-Class vs. type
阅读量:6476 次
发布时间:2019-06-23

本文共 1689 字,大约阅读时间需要 5 分钟。

In some languages, classes are only a compile-time feature (new classes cannot be declared at runtime), while in other languages classes are , and are generally themselves objects (typically of type Class or similar). In these languages, a class that creates classes is called a .

 

Class vs. type[]

In casual use, people often refer to the "class" of an object, but narrowly speaking objects have type: the interface, namely the types of member variables, the signatures of  (methods), and properties these satisfy. At the same time, a class has an implementation (specifically the implementation of the methods), and can create objects of a given type, with a given implementation. In the terms of type theory, a class is an implementation‍—‌a concrete  and collection of subroutines‍—‌while a type is an . Different (concrete) classes can produce objects of the same (abstract) type (depending on type system); for example, the type Stack might be implemented with two classes –  SmallStack (fast for small stacks, but scales poorly) and ScalableStack (scales well but high overhead for small stacks). Similarly, a given class may have several different constructors.

 

Metaclasses[]

Metaclasses are classes whose instances are classes. A metaclass describes a common structure of a collection of classes and can implement a  or describe particular kinds of classes. Metaclasses are often used to describe .

In some languages, such as ,  or , a class is also an object; thus each class is an instance of a unique metaclass that is built into the language.   The  (CLOS) provides  (MOPs) to implement those classes and metaclasses. 

 

https://en.wikipedia.org/wiki/Class_(computer_programming)

转载地址:http://rhlko.baihongyu.com/

你可能感兴趣的文章
使用startActivityForResult方法(转)
查看>>
so在genymotation中错误问题
查看>>
Visual Studio 原生开发的10个调试技巧(二)
查看>>
Windows内核再次出现0Day漏洞 影响win2000到win10所有版本 反病毒软件恐成瞎子
查看>>
H3C品牌刀片系统强势首发
查看>>
激励着我前进
查看>>
我的友情链接
查看>>
npm打包指定本地nexus仓库
查看>>
IP地址简介
查看>>
LDAP服务原理详解
查看>>
Docker容器初体验
查看>>
[ComandDetail] Vim
查看>>
delphi的加密与解密
查看>>
第3部分 管理NTFS权限
查看>>
我的友情链接
查看>>
面试总结之-查找算法分析
查看>>
30天30个Golang程序学习(一):格式化输出
查看>>
Ceisum官方教程1 -- 开始
查看>>
[20171225]变态的windows批处理4.txt
查看>>
树形控件(CTreeCtrl和CTreeView)
查看>>