both asterisk and ampersand in a parameter c++

前端 未结 2 613
独厮守ぢ
独厮守ぢ 2020-12-05 18:54

I am reading a book about Binary Search Tree and something weird came up.

class BST
{
public:
   void insert(const Comparable & item)

private:
   Binary         


        
2条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-05 19:24

    It's reference to pointer, you can change pointer in this function and it will changed outside. Simple example http://liveworkspace.org/code/1EfD0Q$8

提交回复
热议问题