📄 objaggregation.examples2.html
字号:
the class, which are present in the <var class="varname">$ws</var> object. Also absent is the constructor from <b class="classname">WDDXStorage</b>, which will not be logical to aggegate. </p> <p class="para"> <div class="informalexample"> <div class="example-contents"><div class="cdata"><pre>Let's aggregate $fs to the WDDXStorage class$fs objectClass: filestorageproperty: data (array) 0 => 3.1415926535898 1 => kludge != cruftproperty: version = 1.0method: filestoragemethod: writemethod: store</pre></div> </div> </div> </p> <p class="para"> The process of aggregation is cumulative, so when we aggregate <var class="varname">$fs</var> with the class <b class="classname">DBStorage</b>, generating an object that can use the storage methods of all the defined classes. </p> <p class="para"> <div class="informalexample"> <div class="example-contents"><div class="cdata"><pre>Now let us aggregate it to the DBStorage class$fs objectClass: filestorageproperty: data (array) 0 => 3.1415926535898 1 => kludge != cruftproperty: version = 1.0property: dbtype = mysqlmethod: filestoragemethod: writemethod: storemethod: save</pre></div> </div> </div> </p> <p class="para"> Finally, the same way we aggregated properties and methods dynamically, we can also deaggregate them from the object. So, if we deaggregate the class <b class="classname">WDDXStorage</b> from <var class="varname">$fs</var>, we will obtain: </p> <p class="para"> <div class="informalexample"> <div class="example-contents"><div class="cdata"><pre>And deaggregate the WDDXStorage methods and properties$fs objectClass: filestorageproperty: data (array) 0 => 3.1415926535898 1 => kludge != cruftproperty: dbtype = mysqlmethod: filestoragemethod: writemethod: save</pre></div> </div> </div> </p> <p class="para"> One point that we have not mentioned above, is that the process of aggregation will not override existing properties or methods in the objects. For example, the class <b class="classname">FileStorage</b> defines a <var class="varname">$data</var> property, and the class <b class="classname">WDDXStorage</b> also defines a similar property which will not override the one in the object acquired during instantiation from the class <b class="classname">FileStorage</b>. </p> </div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="objaggregation.examples.html">Examples</a></div> <div class="next" style="text-align: right; float: right;"><a href="ref.objaggregation.html">Object Aggregation Functions</a></div> <div class="up"><a href="objaggregation.examples.html">Examples</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -