Question: I've a problem, i've those class, that now works, because i've the attribute in public, but if i put it in private, or protected and inherited to the second class, it not work, how can i do it?

```
template <typename T>
class BinaryNode
{
public:
    T key;
    BinaryNode<T>* left;
    BinaryNode<T>* right;
    BinaryNode<T>* parent;
    BinaryNode(){}
    ~BinaryNode(){}
};

```

And this:

```
template <typename T>
class BinarySearchTree
{
private:
    BinaryNode<T>* root;
    BinaryNode<T>* newNode(T key);

    BinaryNode<T>* minimum(BinaryNode<T>* node);
    BinaryNode<T>* maximum(BinaryNode<T>* node);
    BinaryNode<T>* successor(BinaryNode<T>* node);

    void insert(BinaryNode<T>** node, T key);
    BinaryNode<T>* search(BinaryNode<T>* node, T key);
    void distance(BinaryNode<T>* node, T key);
    void inorderTreeWalk(BinaryNode<T>* node);
public:
    BinarySearchTree();
    ~BinarySearchTree();

    void insert(T key);
    BinaryNode<T>* search(T key);
    void distance(T key);
    void inorderTreeWalk();

    BinaryNode<T>* remove(BinaryNode<T>* node);
};

```

Answer: 
```
savedSession.edit().putString("username", username.getText().toString());

```

Every call to edit() returns you a new Editor instance. So you get an instance, make a change and leave it alone. Then you get a second one and commit that without changes, which results in no value changes in the preferences. 

```
Editor editor = savedSession.edit();
editor.putString("username", username.getText().toString());
editor.putString("password", ""+passtext);
editor.commit();

```
If you call the everytime the `savedSession.edit()` then it will return you different object then you have to call the `commit` method on each to save the values.

So get one instance of the `Editor` like this

```
Editor editor = savedSession.edit();

```

then use this reference to save the values.

Your code should be 

```
Editor editor = savedSession.edit();
editor.putString("username", username.getText().toString());
String passtext = MCrypt.bytesToHex(mcrypt.encrypt(password.getText().toString()));
editor.putString("password", ""+passtext);
editor.commit();

```