SlickEdit Product Discussion > SlickEdit®

Override Method fun

(1/1)

skywise:
(I've submitted this as a bug to support but I was curious if anybody had edited their macro files as a workaround)

In a C++ file, given a setup like this:


--- Code: ---namespace A
{
    class fred
    {
    public:
        virtual DoSomething();
    };
}

namespace Z
{
    class derived : public A::fred
    {
    }
}

--- End code ---

Selecting "override method" in the derived class will result in either a "no overridable methods" pop up or a "this functionality is disabled here" message on the command line.

Removing the namespace ("A::") from fred
(or)

--- Code: ---class derived : public fred
{
}

--- End code ---

Will cause the overridable methods to function correctly (but then, it doesn't compile...) 

As anyone else come up with a slick-c fix? (I traced down several levels to at least confirm that it looks fixable in slick-c but didn't get any further)

Dennis:
I was not able to reproduce this issue in 11.0.1, but, I did have to make a minor change to your example, since "DoSomething" was not being recognized as a prototype since it's return type was missing.

If this is more than a typo in your example, I suggest setting "def_ctags_flags" (Macro > Set Macro Variable...) to 6, which turns on a flag that tells our parser not to ignore old style C prototypes with missing return types.

--Dennis

skywise:
You're right that sample does work... (apologies, I was recreating it from observations and didn't actually test the sample)

It appears that if the namespace/declarations are in the same file than it works fine... so to revise: (and this is simplified from actual code)

In one file I've got an XML parser declaration:


--- Code: ---file: XMLParser.h

namespace XML
{
class XMLParser
{
protected:
     virtual void StartElement(const char* name, const char** atts)
     {
     }
};
}
--- End code ---

Then in another file (a .cpp file, but I don't think that's important)

--- Code: ---file: test.cpp
namespace B
{
class Sam : public XML::XMLParser
{

};
}

--- End code ---

Both files are in the current workspace project.

If you right click in Sam (between the braces) and do override method than you'll get a pop-up box of "No overridable methods found".  If you remove 'XML::' from the XMLParser base declaration and right click on override method, you'll get StartElement as an option to select.

(I'm running version 11.0.1)

Dennis:
Batting zero here.  That example works too.  Have you tried rebuilding the workspace tag file?

Navigation

[0] Message Index

Go to full version