> For the complete documentation index, see [llms.txt](https://richardweiyang-2.gitbook.io/understanding_qemu/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://richardweiyang-2.gitbook.io/understanding_qemu/00-devices/03-objectclass_instance.md).

# 设备实例化

有了设备类型，接着就要实例化设备了。这个理解起来就好像我们可以在一台机器上安装多个同种类的网卡。

实例化完成后会产生如下的对应关系：

```
  ObjectClass                    Object
  +---------------+              +----------------------+
  |               | <------------|class                 |
  |               |              |    (ObjectClass*)    |
  +---------------+              +----------------------+
```

这个过程由object\_initialize()->object\_initialize\_with\_type()实现。其过程实在有点简单：

* 建立obj和ObjectClass之间的关联
* 递归调用父类型的instance\_init
* 调用自己的instance\_init

怎么样，是不是有点超级简单了？

> 太单纯了!
