I have wondered that both c++ and java using oops concepts but the syntaxes are quite different.
I found that java uses new ClassName() to get a reference to the heap but getting the same reference to the heap why the c++ uses new ClassName.
 #include<iostream>
 using namespace std;
class Bike
{
public:
    virtual  void run()
    {
        cout << "running";
    }
};
class Splender :public Bike
{
public:
    void run()
    {
        cout << "running safely with 60km";
    }
};
int main()
{
    Bike &obj = new Splender();//error but reason?
    obj.run();
}
ERROR: invalid initialization of non-const reference of type 'Bike&' from an rvalue of type 'Splender*'
 
     
     
     
    