c++ , can we cast a child class object into parent class type or vise versa.? : <p>I tried this code but getting this compilation error </p>

<pre><code>class A{
};
class B : public A{
};
int main()
{
A a = new B();  // ERROR: "No suitable constructor exists to convert from "B*" to "A".

B b = new A();  // ERROR: "No suitable constructor exists to convert from "A*" to "B".
}
</code></pre>

<p>I am new to C++ and trying to learn . Can someone help me to understand this.</p>
