"error: use of Deleted Function"

Asked

Viewed 174 times

1

I’m having trouble compiling the example below, linux platform for esp8266, I need an example of how to return an object through a class function to another class. As an example: I need access to the object (c) defined in class C, class A.

 #include "b.h"
    #include "c.h"
    class A
    {
        public:
           int start();
        private:            
            B b;
            C c;
            int x;      


    }

    a.cpp

    int A::start()
    {
        c = b.copy();
        x = c.d;
        return x;
    }



    #include "c.h"
    class B
    {
        private:
            C c;        
        public:
            C copy();
    }

    b.cpp

    C B::copy()
    {
        c.add(1);   
        return c;
    }


    class C
    {           
        public:
            void add(int x);
            int d;
    }

    c.cpp

    void c.add(int x)
    {
        C::d = x + 10;
        return;
    }


    main()
   {   
      A a;
      int y;

      y = a.start();

      cout << y ;

   }

When trying to compile on Linux the above example shows the error : "error: use of Deleted Function".

  • I closed as it cannot be reproduced because this problem does not occur in this code, another occurs. I will repeat what I said earlier, see [Ask] and also make a [mcve]. Note that the ideal would be to have put the header. Maybe it causes the reported problem, but in the way the .cpp was written it doesn’t seem that there needs to be header, It may even cause redundancy. For us to help we need a question with relevant information, we need to be able to see the problem you are reporting. I’ll reopen if the question improves.

  • OK Thanks, but the subject is much more complex, I will have to instantiate the classes through pointer, so I can access this, even being in a different class and not referenced or extended.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.