#148 [c#] Smart pointers should not "override" methods.

closed-fixed
None
5
2006-10-24
2006-05-28
No

Methods of smart pointers should not be defined "override" since the methods aren't iherited from a base class.

Discussion

  • Mikael Magnusson

    Logged In: YES
    user_id=141160

    What is the current status of this bugfix?

     
  • William Fulton

    William Fulton - 2006-10-24
    • assigned_to: nobody --> wsfulton
    • status: open --> closed-fixed
     
  • William Fulton

    William Fulton - 2006-10-24

    Logged In: YES
    user_id=242951

    Fixed in cvs for 1.3.30. Fix is slightly different to your
    patch as it removes all the virtual/override/new method
    modifiers which are not needed.

     
  • Mikael Magnusson

    Logged In: YES
    user_id=141160

    I'm still having problems compiling a smart pointer class that contains methods which I had to use %csmethodmodifiers on. Added a patch which works for me.

    Build log
    ---------
    mcs -debug -target:library -out:minisip-sharp.dll *.cs
    GuiRef.cs(84,24): error CS0115: `Minisip.GuiRef.handleCommand(string, Minisip.CommandString)': no suitable method found to override
    GuiRef.cs(89,33): error CS0115: `Minisip.GuiRef.handleCommandResp(string, Minisip.CommandString)': no suitable method found to override
    Compilation failed: 2 error(s), 0 warnings

    Source
    ------
    public override void handleCommand(string subsystem, CommandString cmd) {
    MinisipModulePINVOKE.GuiRef_handleCommand__SWIG_1(swigCPtr, subsystem, CommandString.getCPtr(cmd));
    if (MinisipModulePINVOKE.SWIGPendingException.Pending) throw MinisipModulePINVOKE.SWIGPendingException.Retrieve();
    }

    public override CommandString handleCommandResp(string arg0, CommandString arg1) {
    CommandString ret = new CommandString(MinisipModulePINVOKE.GuiRef_handleCommandResp(swigCPtr, arg0, CommandString.getCPtr(arg1)), true);
    if (MinisipModulePINVOKE.SWIGPendingException.Pending) throw MinisipModulePINVOKE.SWIGPendingException.Retrieve();
    return ret;
    }

    Swig file
    ---------
    /* Fix problem with overriding methods in multiple inheritance */
    %csmethodmodifiers Gui::handleCommand(std::string, const CommandString &) "public override"
    %csmethodmodifiers Gui::handleCommandResp(std::string, const CommandString &) "public override"

     
  • William Fulton

    William Fulton - 2006-10-31

    Logged In: YES
    user_id=242951

    Added a similar patch to yours for this. It is a bit more
    complete in that it removes all new/virtual/override
    keywords from %csmethodmodifiers.

     

Log in to post a comment.