You want to change the type of argument for the method you want to override

Asked 2 years ago, Updated 2 years ago, 32 views

For example, if you would like to change the type of argument msg to MyMessage inherited from Message, what would you do?

Is there no other way than to add it to a class that has a method to override?

MessageHandlerHandlerReqNormalizedCardinal=newMessageHandler(){
    @ Override
    public Message process (Message msg) threads Exception {
        return newRepNormalizedCardinalMessage(MyCFRTCord.this.routingTable.normalizedCardinal);
    }
};

java

2022-09-30 19:49

1 Answers

I didn't try it because I had a preconceived idea that if I cast it, the extended part would disappear.In other words, msg has a pointer in C language. Sorry for asking such a silly question;


2022-09-30 19:49

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.