|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
observable classDear all,
I have a question about "operator=" function member in observable and observer class.
observable& operator=(const observable& o) {
notifyObservers();
return *this;
}
Why does this function have the return type "observable&" instead of "void"? Because I think this function is just to notify the registered observers.
Besides "notifyObservers()", what other things happen if an object of observable is assigned to the other object (e.g. observable1 = observable2)?
Best,
Bohan
------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ QuantLib-users mailing list QuantLib-users@... https://lists.sourceforge.net/lists/listinfo/quantlib-users |
|
|
Re: observable classHi Bohan, Bohan Liu <bliu204@...> writes: > Why does this function have the return type "observable&" instead of "void"? > Because I think this function is just to notify the registered > observers. The reason is so that you can string assignments together in the usual C++ way, i.e., do: o1=o2=o3=o4; > Besides "notifyObservers()", what other things happen if an object of > observable is assigned to the other object (e.g. observable1 = observable2)? Like the comments indicate, the observers are not copied to the new object, so as far as I know, nothing else happens. Derived class can of course implement more functionality in this call to copy over any required class data. Best, Bojan -- Bojan Nikolic || http://www.bnikolic.co.uk ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ QuantLib-users mailing list QuantLib-users@... https://lists.sourceforge.net/lists/listinfo/quantlib-users |
| Free embeddable forum powered by Nabble | Forum Help |