⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 class.3

📁 Object-Oriented Programming With ANSI-C这本书中的源代码!找了很久
💻 3
字号:
.\"	Class.3 -- 1.3 Sep 26 17:55:08 1993.\"	Copyright (c) 1993 Axel T. Schreiner.TH Class 3 "local: ats".SH NAME\f3Class  Class: Object\fP \- root metaclass.SH SYNOPSIS.nfObject    \f3Class\fP.sp .5\f3new(Class(), \f2name\f3, \f2superclass\f3, \f2size\f3, \c\f2selector\f3, \f2tag\f3, \f2method\f3, \f2... \f3, 0);\f1 .sp .5.BI "Object @ allocate (const " self ).BI "const Class @ super (const " self ).BI "const char * nameOf (const " self ).fi.SH DESCRIPTIONA metaclass object describes a class,i.e.,it contains the class.IR name ,a pointer to the class'.I superclass description,the.I sizeof an object in the class,and information about all dynamically linked methodswhich can be applied to objects of the class.This information consists of a pointer to the.I selectorfunction,a.I tagstring for the.B respondsTomethod(which may be empty),and a pointer to the actual.I methodfunction for objects of the class..PPA metaclass is a collection of metaclass objectswhich all contain the same variety of method informations,where, of course, each metaclass object may point todifferent methods.A metaclass description describes a metaclass..PP.B Classis the root metaclass.There is a metaclass object.B Classwhich describes the metaclass.BR Class .Every other metaclass.I Xis described by some other metaclass object.I Xwhich is a member of.BR Class ..PPThe metaclass.B Classcontains a metaclass object.B Objectwhich describes the root class.BR Object .A new class.IR Y ,which has the same dynamically bound methods as the class.BR Object ,is described by a metaclass object.IR Y ,which is a member of.BR Class ..PPA new class.IR Z ,which has more dynamically bound methods than.BR Object ,requires a metaclass object.IR Z ,which is a member of a new metaclass.IR M .This new metaclass has a metaclass description.IR M ,which is a member of.BR Class ..PPThe.B Classconstructor is used to build new class description objects like.I Yand metaclass description objects like.IR M .The.I Mconstructor is used to build new class description objects like.IR Z .The.I Yconstructor builds objects which are members of class.IR Y ,and the.I Zconstructor builds objects in class.IR Z ..PP.B allocatereserves memory for an object of its argument classand installs this class as the class description pointer.Unless overwritten,.B newcalls.B allocateand applies.B ctorto the result..B retrievecalls.B allocateand applies.B getoto the result..PP.B superreturns the superclass from a class description..PP.B nameOfreturns the name from a class description..PPThe.B Classconstructor.B ctorhandles method inheritance.Only information about overwritten methods needs to be passed to.BR new .The information consists of the address of the selectorto locate the method,a tag string which may be empty,and the address of the new method.The method information tuples may appear in any order of methods;zero in place of a.I selectorterminates the list..PP.BR delete ,.BR dtor ,and.B getoare inoperative for class descriptions..PPClass descriptions are only accessed by means of functionswhich initialize the description during the first call..SH SEE ALSOooc(1), retrieve(2)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -