extending the above example Base B;
DerivedClasses D1, D2; B's content -> {content_of_B } D1's content -> { content_of_B, <D1_specific_data_and_functions>} D2's content -> { content_of_B, <D2_specific_data_and_functions>} Can you see the reason now? The above is a very simplified example, think of virtual classes too :). Programmers should realize their critical importance and responsibility in a world gone digital. They are in many ways similar to the priests and monks of Europe's Dark Ages; they are the only ones with the training and insight to read and interpret the "scripture" of this age. On Thu, Jan 20, 2011 at 10:21 PM, yq Zhang <zhangyunq...@gmail.com> wrote: > The reason is simple. The same thing happen in other language such as JAVA. > You can convert Derived class to Base class but you can't convert Derived[] > to Base[]. The reason is, if your Base class has two derived classes D1, D2. > They can exist in Base[] because D1, D2 are valid Base instances. While you > doing converting from Base[] to D1[], it's not possible, because in Base > there are other D2 instances. To avoid these common mistakes, converting > from Derived[] to Base[] it not allowed. > > Yq > > > On Thu, Jan 20, 2011 at 5:54 AM, Decipher <ankurseth...@gmail.com> wrote: > >> When we can convert Derived* to Base* then why can't we convert Derived** >> to Base** ?? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> >> . >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.