给定一个对象(比如下面定义的Foo),静态横切使得创建新方法、添加附加的构造函数,甚至改变继承层次都变得十分简单。
Given an object (such as Foo, defined below), static crosscutting makes it quite simple to create new methods, add additional constructors, and even alter the inheritance hierarchy.
为代码添加枚举功能非常简单,只需在一个打开的记录存储上创建一个RecordEnumeration对象并遍历所有记录即可。
Incorporating enumeration into your code is as easy as creating a RecordEnumeration object from an open record store and looping through each record.
如清单2所示,在一个对象中添加一个新的方法和在一个方面中定义一个方法是同样简单的。
Adding a new method to an object is as simple as defining one in an aspect, as shown in Listing 2.
要向这棵树添加一个子项,可以简单的调用AddItem并传一个指针给它,用来存放添加后的对象。
To add an item to the tree, simply call AddItem and give it a pointer to the type of object being stored.
然后反序列化的对象,简单地读,瞧你与我们所有的对象有一个列表中添加了。
Then to deserialize, simply read in the object, and voila - you have a list with all our objects added in already.
然后反序列化的对象,简单地读,瞧你与我们所有的对象有一个列表中添加了。
Then to deserialize, simply read in the object, and voila - you have a list with all our objects added in already.
应用推荐