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 <[email protected]> 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]<algogeeks%[email protected]> > . > 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
