How to pass the values of two different class type arrangements?

0

I only have one question, how can I pass the values of a class type arrangement to another completely different class type arrangement, when I pass the data the program tells me they are not suitable, what do I have to do to be able to pass the values from one class array to another different class array?

public class Person1(){

public void recogerarreglo(Person2[] person2, int cantidad){
Person1[] person1=new Person1[cantidad];
for(int i=0;i<person1.length;i++){
--->person1[i]=person2[i];}
}
}

There I have the defect signaled.

    
asked by Marco Daniel Coronel Gamez 23.09.2018 в 17:08
source

1 answer

0

I suggest you read an object-oriented paradigm manual. You can only relate two different classes if both have some superclass in common or if they are implementing the same interface. Not because you have objects that differ in details you will create a different class for each one, remember that a class is an abstraction that gathers details common to a group of objects.

    
answered by 23.09.2018 в 21:11