Author Topic: Override Method fun  (Read 5848 times)

skywise

  • Senior Community Member
  • Posts: 331
  • Hero Points: 10
Override Method fun
« on: August 22, 2006, 07:09:25 PM »
(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: [Select]
namespace A
{
    class fred
    {
    public:
        virtual DoSomething();
    };
}

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

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: [Select]
class derived : public fred
{
}

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

  • Senior Community Member
  • Posts: 3960
  • Hero Points: 517
Re: Override Method fun
« Reply #1 on: August 28, 2006, 03:27:38 PM »
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

  • Senior Community Member
  • Posts: 331
  • Hero Points: 10
Re: Override Method fun
« Reply #2 on: August 28, 2006, 03:49:23 PM »
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: [Select]
file: XMLParser.h

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

Then in another file (a .cpp file, but I don't think that's important)
Code: [Select]
file: test.cpp
namespace B
{
class Sam : public XML::XMLParser
{

};
}

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

  • Senior Community Member
  • Posts: 3960
  • Hero Points: 517
Re: Override Method fun
« Reply #3 on: August 28, 2006, 05:43:51 PM »
Batting zero here.  That example works too.  Have you tried rebuilding the workspace tag file?