value of 1-dimensional array of class1 cannot be converted to value of 1dimensional array of class2 because class1 is not derived from class2.

wht does this error mean
value of type '1-dimensional array of class1 cannot be converted to value of 1dimensional array of class2 because class1 is not derived from class2.
Thank you
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

you can't convert an orange into an apple........but you can convert them into fruit....
Right.  It would help us to get you a solution if you explain why you are trying to convert an array of class1 to class2.  there can be a few things you can do:

1. Derive class1 from class2 (this doesn't sound like the correct solution)
2. Use a generic array or collection object that can store any type of object (ie ArrayList)
3. simply use two arrays

the correct answer really depends upon what you are doing.
Joel CoehoornDirector of Information TechnologyCommented:
tracy_pAuthor Commented:
i am calling a function of one class into a function of another this something wrong??
do you mean the classes are different, but they have the same function definitions, and you'd simply like to re-use the array since it is calling the same function?  In that case, that's what you would use interfaces for.  You would define an interface (ie ImyInterface) with that function definition, then have both class1 and class2 implement that interface.  Then you could have both types of objects in the same array of type ImyInterface.

From the sounds of it, though, things would be a lot simpler for you just to have two arrays.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.