Reduction of namespace: Class:



  • Got a class. Here's his title:

    namespace FlightController
    {
        public ref class FlightController
        {
            public:
                FlightController();
        };
    }
    

    On my request, the studio itself added the designer to .cpp to read:

    #include "FlightController.h"
    

    FlightController::FlightController::FlightController()
    {
    throw gcnew System::NotImplementedException();
    }

    I'm embarrassed by this:

    FlightController::FlightController::FlightController()

    If I'm in the file .cpp adding using namespace FlightController;The compiler makes a mistake:

    FlightController ambiguous symbol

    Is it possible to eliminate the need for a reference code file to write namespace::Класс::Метод? Is there any way to cut it down? Метод or Класс::Метод?



  • Try writing like:

    namespace FlightController
    {
    
    FlightController::FlightController()
    {
        ...
    }
    
    // остальные методы
    

    }

    When you write using namespace FlightControllerYou're outside. FlightController Maybe. namespaceand class♪ In case you're inside namespace FlightControllerthe first option goes away, except for a case where it's inside. namespace FlightController There's more. Annex namespace FlightController!




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2