December 2009
Intermediate to advanced
380 pages
9h 2m
English
Classes are like structs in that they can inherit members from another class (the superclass). That means classes have two parent scopes: the usual enclosing scope (physical location) and a superclass scope. To resolve symbols, sometimes we’ll chase the enclosing scope pointer, and sometimes we’ll chase the superclass pointer. Let’s start by looking at the scope tree for the following Cymbol code (see Figure 17, Scope tree for classes A and B).

| symtab/class/AB.cymbol | |
| ① | // start of global scope // |
| ② | class A { |
| | public: |
| | int x; |
| ③ | void foo() |
| ④ | { ; } |
| | }; ... |