hi, I 've got a simple problem with subclass and method (I'll leave out some keywords to go direct to problem...).This isn't real C++ but the concept shouldn't change...
Qt Code:
  1. abstract baseClass {
  2. List <baseClass> list = new List<BaseClass>();
  3. List<Two> list_two=new List<Two>();
  4.  
  5. virtual add(BaseClass class) {
  6. list.Add(class);
  7. if (class.Type is "Two" also do.......)
  8. list_two.Add(class); //here error, because class hasn't same type of list_two...
  9. }
  10. }
  11.  
  12.  
  13. class One : baseClass {
  14. override void add(BaseClass class) {
  15. // do something
  16. base.add(class);
  17. }
  18. }
  19.  
  20.  
  21. class Two : baseClass{
  22. //constructor and the rest
  23. }
  24.  
  25. main {
  26. Two two;
  27. One one;
  28. one.add(new two() );
  29. }
To copy to clipboard, switch view to plain text mode 
Must I have refactor the classes or how can I do this things?
thanks...