📄 object.3
字号:
.\" Object.3 -- 1.4 Sep 26 18:08:58 1993.\" Copyright (c) 1993 Axel T. Schreiner.TH Object 3 "local: ats".SH NAME\f3Class Object\fP \(em root class.SH SYNOPSIS.nf\f3Object\fP Class.sp .5.B new(Object());.sp .5.B "typedef void (* Method) ();".sp .5.BI "const void * classOf (const " self ).BI "size_t sizeOf (const " self ).BI "int isA (const " self ", const Class @ " class ).BI "int isOf (const " self ", const Class @ " class ).BI "void * cast (const Class @ " class ", const " self ).BI "Method respondsTo (const " self ", const char * " tag ).B %\(mi.BI "void * ctor (" self ", va_list * " app ).BI "void delete (" self ).BI "void * dtor (" self ).BI "int puto (const " self ", FILE * " fp ).BI "void * geto (" self ", FILE * " fp )\f3void forward (\f2self\f3, void * \f2result\f3, Method \f2selector\f3, const char * \f2name\f3, ...)\f1.B %+.BI "Object @ new (const " self ", ...)".fi.SH DESCRIPTION.B Objectis the root class;all classes and metaclasses have.B Objectas their ultimate superclass.Metaclasses have.B Classas their penultimate superclass..PP.B classOfreturns the class description of an object;.B sizeOfreturns the size in bytes..PP.B isAreturns true if an object is described by a specific class description,i.e., if it belongs to that class..B isAis false for null pointers..B isOfreturns true, if an object belongs to a specific classor has it as a superclass..B isOfis false for null pointers and true for any object and the class.BR Object ..PP.B castchecks if its second argument is described,directly or ultimately, by the first.If not, and in particular for null pointers,the calling program is terminated..B castnormally returns its second argument unchanged;for efficiency,.B castcould be replaced by a macro..PP.B respondsToreturns zero or a method selectorcorresponding to a tag for some object.If the result is not null,the object with other arguments as appropriate can be passed to this selector..PP.B ctoris the constructor.It receives the additional arguments from.BR new .It should first call.BR super_ctor ,which may use up part of the argument list,and then handle its own initialization from the rest of the argument list..PPUnless overwritten,.B deletedestroys an object by calling.B dtorand sending the result to.BR free (3).Null pointers may not be passed to.BR delete ..PP.B dtoris responsible for reclaiming resources acquired by the object.It will normally call.B super_dtorand let it determine its result.If a null pointer is returned,.B deletewill effectively not reclaim the space for the object..PP.B putowrites an \s-1ASCII\s0 representation of an object to a stream.It will normally call.B putofor the superclass so that the output starts with the class name.The representation must be designed so that.B getocan retrieve all but the class name from the streamand place the information into the area passed as first argument..B getoworks just like.B ctorand will normally let the superclass.B getohandle the partwritten by the superclass.BR puto ..PP.B forwardis called by a selectorif it cannot be applied to an object.The method can be overwritten to forward messages..PPUnless overwritten,.B newcalls.B allocateand passes the result to.B ctortogether with its remaining arguments..SH SEE ALSOooc(1), retrieve(2), Class(3)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -