小编bca*_*can的帖子

Windows 10上的Ubuntu上的Bash是否支持usb?

  • 我在dev /上没有关于usb的文件或路径
  • 当我插入闪存盘时,dev /或mnt /或media /上没有任何内容.
  • sudo lsusb 收益:

    unable to initialize libusb: -99
    
    Run Code Online (Sandbox Code Playgroud)

我该怎么做才能在bash上启用usb访问?

linux windows bash ubuntu windows-subsystem-for-linux

23
推荐指数
2
解决办法
4万
查看次数

如何创建使用重写函数的非成员函数?

在这段代码中我尝试基本上重载+ =操作.在非成员部分看起来一切都很好,但是当我写一个非成员函数时,(+这部分中的操作)它给出了无效的抽象返回类型错误,并说+ = operation在vector1d中是纯粹的.我怎么解决这个问题?

class AbstractBase{
        public:
        virtual AbstractBase &operator+=(const AbstractBase &other)=0;

        private:
        }
     ////   
        class Vector1d:public AbstractBase{
        public:
        Vector1d &operator+=(const Vector1d &other);

        private:
          int size_;
          vector<double> data_;

        }
        //non member func
        Vector1d operator+(const Vector1d& vec1, const Vector1d& vec2);


        ///


        Vector1d &Vector1d::operator+=(const Vector1d &other){
                cout<<"sum operator is called"<<endl;
                for(int i = 0; i < other.size_ ; i++)
                data_.at(i) += other.data_.at(i);
                return *this;
            }

        Vector1d operator+(const Vector1d& vec1, const Vector1d& vec2){
        return  (Vector1d) vec1 += vec2;
        };
Run Code Online (Sandbox Code Playgroud)

c++ oop operators

1
推荐指数
1
解决办法
144
查看次数