Originally Posted by
tbscope
You can not turn an apple in an orange, even in C#.
certainly no, but that wasn't even what i was saying, i was asking for turning fruit into either orange or apple... very common example i use when i explain polymorphism in C# is:
List<MyColors> colors = new List<MyColors>();
colors.Add(new MyRed());
colors.Add(new MyBlue());
colors.Add(new MyGreen());
List<MyColors> colors = new List<MyColors>();
colors.Add(new MyRed());
colors.Add(new MyBlue());
colors.Add(new MyGreen());
To copy to clipboard, switch view to plain text mode
and this would only be if all MyRed, MyBlue and MyGreen was derived from class MyColors.
anyway i really appreciate your reply, and i have already come over the problem.
what i did is i created two functions with following signatures;
QTreeWidgetItem* cObj::toQTreeWidgetItem(QTreeWidget *parent);
cObj* _cObj::fromQTreeWidgetItem(const QTreeWidgetItem* item);
To copy to clipboard, switch view to plain text mode
and its working as expected..
still trying to find a way around exec() and whats that for (in QThread) and how to make loop work...
i have got following code:
for (int i=1 ; i< cObject->list.count() ; i++) //starting from 1 intentionally
{
cThread=&cObject->list[i][0]; //cObject is cObj (inherited from QThread) and list is vector i.e, vector<cObj*>
cThread->start(); //cThread is cObj
}
for (int i=1 ; i< cObject->list.count() ; i++) //starting from 1 intentionally
{
cThread=&cObject->list[i][0]; //cObject is cObj (inherited from QThread) and list is vector i.e, vector<cObj*>
cThread->start(); //cThread is cObj
}
To copy to clipboard, switch view to plain text mode
my problem is if i call "cThread->skip()" program ends straight away unexpectedly, but what i want is to process (so run()) for next iteration...
any expertises will be helpful!
appreciated!
Bookmarks