Author Topic: push-tag not working to go to base class implementation?  (Read 195 times)

rowbearto

  • Senior Community Member
  • Posts: 2109
  • Hero Points: 127
push-tag not working to go to base class implementation?
« on: January 10, 2022, 04:52:52 pm »
In my C++ application I have a problem where I don't see the choice for a base class implementation in push-tag.

For the exact place where I encounter the problem look for:

// PROBLEM in the code snipped below for the details.

Code: [Select]
namespace base_namespace {

 class BaseClass : public base_namespace::SomeOtherBaseClassNotProvidedInThisExample {
   public:
     virtual bool startUpSequence();
  } // class BaseClass
} // namespace base_namespace

namespace derived_namespace {

  class DerivedClass : public base_namespace:BaseClass {
    public:
     bool startUpSequence() override;
  }

  bool DerivedClass::startUpSequence() {
    // PROBLEM: When I do a push-tag on 'startupSequence()' below I don't
    // get a choice of seeing BaseClass::startUpSequence(), only DerivedClass::startUpSequence()
    // is in the list. In fact in my application there are 2 different DerivedClass based on this base class
    // I see the choices for the 2 derived classes but not a choice for the base class version of startUpSequence()
    // Should the other derived class even be in this list?
    bool ret = BaseClass::startUpSequence()
  }

} // namespace derived_namespace

I am using 26.0.1 on Linux x64
« Last Edit: January 10, 2022, 04:57:34 pm by rowbearto »

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 3530
  • Hero Points: 471
Re: push-tag not working to go to base class implementation?
« Reply #1 on: January 11, 2022, 11:24:18 pm »
I am checking in a partial hot fix for this for 26.0.1, so that should be part of an upcoming cumulative hot fix.

A secondary problem was that the prototype "bool startupSequence() override" was not being tagged as a virtual function, even though in C++ you are only allowed to override virtual functions, so it is fair to assume it is virtual despite the missing qualification.  This tagging issue will be fixed in 26.0.2 or 27.0.0, whichever comes first.  A workaround is to put in the virtual keyword.

rowbearto

  • Senior Community Member
  • Posts: 2109
  • Hero Points: 127
Re: push-tag not working to go to base class implementation?
« Reply #2 on: January 12, 2022, 02:41:39 am »
I think it is fair to assume it is virtual despite the missing qualification.

According to cppreference:

https://en.cppreference.com/w/cpp/language/override

Quote
Specifies that a virtual function overrides another virtual function.

So this means that the prototype with the 'override' is also a virtual function, even though it is not required to have virtual keyword.