当我定义一个继承自的新类时NSObject:
@interface Photo : NSObject
{
NSString* caption;
NSString* photographer;
}
@property NSString* caption;
@property NSString* photographer;
@end
Run Code Online (Sandbox Code Playgroud)
是新类继承的所有类方法(如alloc)吗?NSObjectPhoto
function Foo() {
alert(this === a);//return false! **why this is not equal a?**
}
var a = new Foo();//create a new object
Run Code Online (Sandbox Code Playgroud)
foo是一个构造函数,为什么'Foo'中的这个与'a'不相等.
如果pair以空格char结尾,为什么结果值包含一个点(.)?这个点(.)是什么意思?
(cons 1 2 )
;Value 2: (1 . 2)
(car (cons 1 2 ))
;Value: 1
(cdr (cons 1 2 ))
;Value: 2
Run Code Online (Sandbox Code Playgroud)
这一个看起来很愚蠢,因为对只包含两个元素.
我只是想知道为什么第一个表达式在结果中回显一个点!
(cadr (cons 1 2 ))
;The object 2, passed as an argument to safe-car, is not a pair.
;To continue, call RESTART with an option number:
; (RESTART 1) => Return to read-eval-print level 1.
Run Code Online (Sandbox Code Playgroud)
谢谢!
class-method ×1
constructor ×1
inheritance ×1
javascript ×1
lisp ×1
objective-c ×1
scheme ×1
sicp ×1
subclass ×1