And I want to show you a little bit more detail of that, so let's create a simple little list here.
我还想给你们再讲详细些,那让我们来创建一个简单的列表吧。
Right now it's a simple template, but it's a template for creating what a class looks like, and I now have an x- and y- value associated with each instance of this.
那么大家明白了为什么,我说类是一个模板了,对不对?,现在它只是一个简单的模板,但是它是一个用来-,创建形成一个类的模板。
And then to create the object, I'll simply do a set of inserts.
我将此返回做为我的集合,然后创建对象,我会一系统简单的插入操作。
So, what's the idea? If I know what my hash function does, it maps, in this case characters into a range zero to 256, which is zero to 255, I create a list that long, and I simply mark things.
我知道我的哈希函数做什么,在这个例子中,它将字母,映射成0到255的256个数字,我创建了一个这么长的列表,并且我只是简单的标志这些东西。
What we're really getting at is the idea of saying I want to have a way of grouping together information into units that make sense. So I can go back to one of those topics we had at the beginning, which is the idea of abstraction, that I can create one of those units as a simple entity, bury away the details and write really modular code.
组合成为有意义的单元,那么这就让我们回到,一开始讲的话题之一了,这就是抽象的概念,也就是我可以以一个简单的,实体的形式创建这样的一个单元,把具体实现隐藏然后写一些,真正模块化的代码,我们在以后的课程中。
应用推荐