OK, so I don't have to, it's a great question, I don't have to create a second one for cmp.
但是参数的顺序是相反的,好,那么我就不必,这是个很不错的问题,我就不必再创建。
So the version I'd like you to have uses, that, greater than rather than equals that I had in my handout.
因此我希望大家用我说的这个,把课堂手册中的等于换成大于,这里cmp方法。
Some of which I built: cmp, init, str. And there, notice, are the internal definitions And in fact I should've said, we often call those things fields.
就是给我一个所有东西的列表:,所有的方法,与这个类关联的,有一些是我写的:,还有这里,请注意,是一些内部的定义。
cmp My handout's wrong, which I discovered this morning after I printed them all out.
还有,我的课堂手册有错误,我上午打印完才发现有错误。
What's cmp doing as a method?
是用来做什么的?
Well, I have cmp.
好,在这里还有什么?
Same thing with cmp, that's just saying greater than, and greater than now can apply to strings, it can apply to floats, it could apply to points, it could add other pieces into it.
是不是相等?,这跟cmp是一样的,这个只不过是说大于,大于现在可以应用于字符串,可以应用于浮点数,可以应用于点。
It's still calling cmp, but it's knowing that cmp is just reversing the order of the arguments.
下一次我会带上正确的眼镜的,这还是会去调用cmp方法的,但是我们知道。
Cmp is just saying, cmp and if I want to reverse it, it goes the other way.
一个比较的方法了,的意思是,是不是大于,is,this,bigger,than,如果我反转了参数的顺序,它的意思就是是不是小于了。
STUDENT: PROFESSOR: Right, cmp other, so how would I call this?
学生:不可闻的声音:,教授:对,cmp另外一个对象,那么我怎么来调用这个方法呢?
应用推荐