- pass * as a function parameter
#include <iostream>
class A {
 public: 
  A() {}
};
class B : public A{
 public:
  B() {}
};
void foo(A* a) {
 a = new B();
}
void ff() {
  A a;
  foo(&a);
}
- pass ** as a function parameter
#include <iostream>
class A {
 public: 
  A() {}
};
class B : public A{
 public:
  B() {}
};
void foo(A** a) {
 *a = new B();
}
void ff() {
  A* a;
  foo(&a);
}
When I see leveldb, I am in a puzzle about this.
The specific code is the following.
https://github.com/google/leveldb/blob/master/db/db_impl.cc#L1537
I think it's ok to use FileLock lock
Then pass &lock to LockFile(const std::string& filename, FileLock* lock)
LockFile function is this
 
     
    