[Logo]
Forums Register Login
Unable to add an element to an arraylist using extended class
Dear all,
I am facing a problem of using an class which is a sub class of another. Using in the sense, putting the attributes of the extended class into the arraylist that initially uses the original class for the main class. I hope to understand more about this problem. Here are the codes..





any comments or help on this topic will be great.

regards,
Jon
 
I am facing a problem of using an class which is a sub class of another.


I am assuming that the problem that you are facing, is that it won't compile? As neither of the two classes have constructors that has the same name as the class. (and if they are methods, then they don't have a return type).

Henry
Hi Henry,

Thanks for replying.

Actually I am using the methods like this.

and it shows this when i highlight it.

incompatible types
found CompactDisc
required: DVD


any comments or help on this topic would be great!

thanks
dear all,

does this thread able to help me to solve the current problem? Now I am trying to figure out the function of the "buffer"...

any comments or help on this thread would be great!

edit: This above coding does not work on my coding because the current class has this..
public class DVD extends CompactDisc {

also i found an example from here which i understand but i am unable to implement it on the code which i have..

Regards,
Jon

Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards



All times above are in ranch (not your local) time.
The current ranch time is
Nov 19, 2017 14:58:17.