Help with pseudo multi inheritance - page 3

To add comments, please log in or register
d.bignotti
216
d.bignotti  
nicholishen:
Let's give it a shot... Go

Basically what i'm trying to do is MVC, if you notice inside each file there's at the bottom a java example of what i'm trying to do, the ChatView model impement some sort of GUI, not really interested in making a GUI now, just print a MessageBox and Alert instead.

I'm stuck right now with the design of this, i just want the entire design to work. Good Luck :)

Files:
MVC.zip 13 kb
nicholi shen
2392
nicholi shen  
Amir Yacoby:
No. The CLine is subject. It generates OnPriceCross () event when it is crossed.
In OnPriceCrossed () method, it calls Notify () to inform observers.
That's not a relevant example because it'll always have a 1:1 relationship of lines to strategies. It's backwards. One strategy multiple trendlines is what you need... Not the other way around 
nicholi shen
2392
nicholi shen  
d.bignotti:

Basically what i'm trying to do is MVC, if you notice inside each file there's at the bottom a java example of what i'm trying to do, the ChatView model impement some sort of GUI, not really interested in making a GUI now, just print a MessageBox and Alert instead.

I'm stuck right now with the design of this, i just want the entire design to work. Good Luck :)

Tell me what you want to actually do.
Amir Yacoby
1364
Amir Yacoby  
nicholishen:
That's not a relevant example because it'll always have a 1:1 relationship of lines to strategies. It's backwards. One strategy multiple trendlines is what you need... Not the other way around 
There are many strategies interested in this. The line has nothing to investigate about the strategy. 
It is just a line, what interest it has about strategies :)

d.bignotti
216
d.bignotti  
nicholishen:
Tell me what you want to actually do.

Just follow the java example in each file attached in the above post, for the ChatView part don't worry about gui just print some message.

nicholi shen
2392
nicholi shen  
d.bignotti:

Just follow the java example in each file attached in the above post, for the ChatView part don't worry about gui just print some message.


I'm not interested in java examples. I want to know exactly what you hope to accomplish with MQL...

nicholi shen
2392
nicholi shen  
Amir Yacoby:
There are many strategies interested in this. The line has nothing to investigate about the strategy. 
It is just a line, what interest it has about strategies :)


In that case it is simple. 

  1. Clone the Trade folder to the project folder
  2. Change CTrade declaration to derive Observer
  3. Clone ChartObjects folder to project folder
  4. Change CChartObject declaration to derive Subject.
done.

d.bignotti
216
d.bignotti  
nicholishen:

I'm not interested in java examples. I want to know exactly what you hope to accomplish with MQL...


Project i'm planning is will have a GUI and i wanted to use MVC design. I can't really tell what i'm trying to accomplish right now, its a big project for me, i was making this model just to see if i can get the MVC working, that's why i was following that java example.

But if you want to make more concrete stuff, just make a strategy that inform you when 2 ma cross, and use 2 edit text field as input parameter on chart. If possible mantaining MVC design like in the example i attached. Can't think of anything else really.

Amir Yacoby
1364
Amir Yacoby  
nicholishen:

In that case it is simple. 

  1. Clone the Trade folder to the project folder
  2. Change CTrade declaration to derive Observer
  3. Clone ChartObjects folder to project folder
  4. Change CChartObject declaration to derive Subject.
done.


No. 
CTradeStrategy1 is a descendent of many classes in between CObject and itself. You can not clone it and derive other class because you lose the classes in between them. 
* You maybe assume that the folder of Trade has all the lineage of classes but its not a must. And you cant make other classes in folder as observers.

This is not a solution, it will not work and on top of it is inconvinient.  

* And thats why you are wrong when you think that multiple inheritance can be achieved like that. Its not.



nicholi shen
2392
nicholi shen  
Amir Yacoby:

No. 
CTradeStrategy1 is a descendent of many classes in between CObject and itself. You can not clone it and derive other class because you lose the classes in between them.

This is not a solution, it will not work and on top of it is inconvinient.  

* And thats why you are wrong when you think that multiple inherutance can be achieved like that. Its not.




I beg to differ, I am in fact not wrong.

class Observer : public CObject
class CTrade : public Observer
class CTradeStrategy : public CTrade

No classes were "lost" and the implementation inheritance is the exact same as using multiple inheritance. 


I feel like something is getting lost here... Are you using an English translator? Do you understand what it means to clone a class/folder into the project directory?

To add comments, please log in or register