I am studying inheritance and polymorphism in C++ and I came across this example:

```
class Parent
{
    public:
        void a()
        {
             std::cout << "parentA";
        }

        virtual void b()
        {
             std::cout<<"parentB";
        }
 };

 class Child : public Parent
 {
     public:
        void b()
        {
             std::cout<<"childB";
        }
 };

```

Then in main:

```
int main()
{
    Parent i= Child();
    i.b(); //why doesn't this give parentB?

    Parent *j= new Child();
    j->b();
}

```

The outputs are parentA and childB respectively but I can't understand why. (isn't b() overriding?)