扩展和/或参数对象作为属性
正如我现在从 array作为对象,因为使用非参数logtalk对象意味着我必须使用断言,即任何更改/设置重写整个数组。
问题是:
- 您如何扩展数组类..
- 或将其实例化为主机类
点1
:- object(a2d, instantiates(array)).
:- end_object.
- 中的属性
引用未知对象:数组
即使有效,您如何在内部访问它。
Point2
意味着以某种方式修改术语?
As I understand now from Array as object I have to use parametric object, because using non-parametric Logtalk objects implies that I have to use assert i.e. any change/set rewrites the whole array.
The problem is then :
- how do you EXTEND the Array class..
- OR instantiate it as ATTRIBUTE in the host class
Point 1
:- object(a2d, instantiates(array)).
:- end_object.
Reference to unknown object: array
even if it works, how do u access it internally .
Point2
means modifying the Term somehow ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

在该参数对象解决方案中,该对象用于封装在数组表示上工作的谓词,而对象参数用于保留代表数组本身的(化合物)项。
在这种情况下,参数对象,a prototype 可以是扩展作为任何其他原型:
请注意,参数对象的标识符是
array(_)(即一个复合术语)。因此,
数组(_)
和数组
是不同对象的标识符。In that parametric object solution, the object is used to encapsulate the predicates working on the array representation and object parameter is used to hold the (compound) term representing an array itself.
The parametric object, a prototype in this case, can be extended as any other prototype:
Note that the identifier of the parametric object is
array(_)
(i.e. a compound term). Thus,array(_)
andarray
are identifiers for different objects.