Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 Pharo Smalltalk 中使用特征时是否可以使用 instanceVariables?
Trait named: #Personnel uses:{} category: 'Test'
我想添加一些其他类可以从这些特征中使用的变量。这在 Smalltalk 中可能吗?
不。特征是无状态的可组合单元,简单来说就是:没有属性,只有方法。
更详细的解释可以看一下:http ://scg.unibe.ch/archive/papers/Scha03aTraits.pdf