小编Nas*_*ash的帖子

无效使用非静态成员函数

我有这样的事情:

class Bar
      {
      public:
        pair<string,string> one;
        std::vector<string> cars;
        Bar(string one, string two, string car);
      };

class Car
      {
      public:
        string rz;
        Bar* owner;
        Car(string car, Bar* p);
      };

class Foo
       {
         public:
          Foo  ( void );
          ~Foo  ( void );
          int Count ( const string & one, const string &  two) const;
          int comparator (const Bar & first, const Bar & second) const;            
            std::vector<Bar> bars;
       };

int Foo::comparator(const Bar & first, const Bar & second) const{
  return first.name < …
Run Code Online (Sandbox Code Playgroud)

c++ const function member non-static

19
推荐指数
3
解决办法
13万
查看次数

标签 统计

c++ ×1

const ×1

function ×1

member ×1

non-static ×1