A virtual function error
so please help so that it works in ubuntu
/*Write a program having a base class- num. Have this class hold an integer value and contain a virtual function shownum(). Create two derived classes- displayhex and displayoct that inherit class num. Have the derived classes override shownum() so that to display the value in heaxdecimal and octal respectively.*/ #include<iostream> using namespace std; class num { protected: int i; public: num(int n) {i=n;} virtual void shownum() { cout<<endl<<"the value of i is "<<i; } }; class hex:public num { public: hex(int n):num(n) { } void shownum() { cout<<endl<<"the value of int i in hex is "<<i; } }; int main() { int i; cout<<endl<<"enter the value of integer u wana to change to hex decimal"; cin>>i; hex h1(i); num *h; h=&h1; h->shownum(); return 0; delete h; }