I am new in programing and I am analyzing code with parent class fruit and child classes apple and pear. In this example there is pointer to parent class. After I extended this code I find out that using object I can access parent public members and all child members. Question is why do I need those pointers?

```
// are this pointer needed since I can use j.setWeight(11)

#include <iostream>

using namespace std;

class fruit {
private:
    int weight;

public:
    void setWeight(int x)
    {
        weight = x;
    }
    int getWeight()
    {
        return weight;
    }
};

class apple : public fruit {
public:
    void eat()
    {
        cout << "Now I am eating apple"
             << "=" << getWeight() << endl;
    }
};

class pear : public fruit {
public:
    void eat()
    {
        cout << "Now I am eating pear"
             << " = " << getWeight() << endl;
    }
};

int main()
{
    apple j;
    pear k;
    fruit* fruit1 = &j;
    fruit* fruit2 = &k;
    k.setWeight(5);
    k.eat();
    fruit1->setWeight(11);
    apple apple;
    apple.postaviTezinu(16);
    apple.jelo();

    return 0;
}

are this pointers needed since I can use j.setWeight(11) and results is same as 
fruit1 -> setWeight(11) ... what s difference, thx

```