Question: can you explain me why:

```
int main (int argc, char * const argv[]) {
    Parent* p = new Child();
    p->Method();
    return 0;
}

```

prints "**Child::Method()**", and this:

```
int main (int argc, char * const argv[]) {
    Parent p = *(new Child());
    p.Method();
    return 0;
}

```

prints "**Parent::Method()**"?

Classes:

```
class Parent {
public:
    void virtual Method() {
        std::cout << "Parent::Method()";
    }
};

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

```

Thanks,
Etam.

Answer: 
In the first case, you've got a 'Parent' pointer on a 'Child' object, which is somehow generic, since 'Child' inherits from 'Parent'. Hence the overloaded 'Child' method is called.

In the second case, you make an implicit cast of a 'Child' instance to the type 'Parent', hence you're calling the method on a 'Parent' object.

Hope this helps.
In the first case, the type of the object pointed by pointer p is of 'Child' type. Since child is overriding the virtual method defined in the base class, child's method is called. In the second case, you have **copied** the child object into a parent object. Here the object slicing occurs and the type of the resultant object is of type 'Parent'. Hence when you call the method, parent's method is called.