Help with pseudo multi inheritance - page 2

 
Amir Yacoby:
Sorry, I don't mean to bug you.
Yes you can do that.
For instance:
class CSubject {}
class CObserver : public CSubject {}
class CObserverWrapper : public CObserver {}

But with several drawbacks:
1. It is not a neat structure
2. All your objects become subject and observer regardless if they use it or not
3. You cant apply all the patterns in this way.

As we agree on the observer I will stop commenting about it in this context.
This is not how you'd implement it. You wouldn't have a class that is both Subject and observer. 
 
nicholishen:
This is not how you'd implement it. You wouldn't have a class that is both Subject and observer. 
The stage is yours
 
Amir Yacoby:
The stage is yours
Ok. You tell me which std library class you want to implement observer and which class you want to implement subject and tell show you how to do it.
 
nicholishen:
Ok. You tell me which std library class you want to implement observer and which class you want to implement subject and tell show you how to do it.
Ok. I already do it but lets see your way.
Lets make CLine as subject and CStrategyBreak : public CTrade observes. (Just for example)

* I see what you are going to do now. You are going to inherit CObserverWrapper on the observer side and CSubjectWrapper on the subject side. Nice idea, still I prefer my way.
 
Amir Yacoby:
Ok. I already do it but lets see your way.
Lets make CLine as subject and CStrategyBreak : public CTrade observes. (Just for example)
Let's use a real example. I just don't see a relevant use of a line as the subject and CTrade as observer... 
 
nicholishen:
Let's use a real example. I just don't see a relevant use of a line as the subject and CTrade as observer... 

What if i'm telling you what i'm trying to do? So you also help me with my noob experience? :)

 
nicholishen:
Let's use a real example. I just don't see a relevant use of a line as the subject and CTrade as observer... 
Why not, you have a strategy class that observes a trend line(or many of them) for crossing of price

The strategy class uses std classes but is not part of std lib

 
Amir Yacoby:
Why not, you have a strategy class that observes a trend line(or many of them) for crossing of price

The strategy class uses std classes but is not part of std lib

If that's the case then you had them backwards. The trend lines are observers and the strategy is the subject.
 
d.bignotti:

What if i'm telling you what i'm trying to do? So you also help me with my noob experience? :)

Let's give it a shot... Go
 
nicholishen:
If that's the case then you had them backwards. The trend lines are observers and the strategy is the subject.
No. The CLine is subject. It generates OnPriceCross () event when it is crossed.
In OnPriceCrossed () method, it calls Notify () to inform observers, which can be many with interest.
Reason: