Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

casting between classes

807597Jan 30 2005 — edited Jan 31 2005
Hi;

I have a method in a class that should pass an object of class type "old"
and I want the modified object of this class to be used,
i.e., the object to be used should be of type "new" in the new.java
where classmethod.java should use (x :old) in the method needed.


here; i need to invoke the method "method()" in the file new.java as follows

method(this);

but in the implementation of "method()" (in classmethod.java) I want to use the object of type "old".

how could i do tha casting?

i did this in classmethod.java


contrsuctormethod( new a){
method ((old) a);
}


but it gives me an error
(inconvertable types)
how could I solve this?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 28 2005
Added on Jan 30 2005
7 comments
454 views