A virtual function error

i am working in ubuntu
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
 
using namespace std;

class num
{
 protected:
  int i;
 public:
  num(int n)
 {i=n;}

 virtual void shownum()
  {
    cout<>i;
  hex h1(i);
  num *h;
  h=&h1;
  h->shownum();

 return 0;
 
  delete h;
}  

Replies

  • Rifaa
    Rifaa
    I don't think any one uses ubuntu here dude. I did once just to check it out. Sorry I could not tell u more yet.
  • arunhero99
    arunhero99
    I got a Red Hat Enterprise Linux. i didn't actually understand what you expect by making it work in ubuntu. Is it working in all other platforms? will making it compile in linux do?
  • vivek.m
    vivek.m
    Hi,

    Please paste the errors you get in ubuntu in the following code

    #include 
    using std::cout;
    using std::endl;
    using std::ios;
    
    class num
    {
    protected:
        int i;
    public:
        num(int n)
        {
            i=n;
        }
    
        virtual void shownum()
        {
            cout<<"the value of i is "<shownum();
        objOct->shownum();
    
        delete objOct;
        delete objHex;
        return 0;
    }
    
  • yam.rules
    yam.rules
    oh bahlle so got that working in ur op
  • ahammedali
    ahammedali
    sorry man i dont know more about ubuntu
    😕
  • ahammedali
    ahammedali
    hellow im ahammedali from kerala. im new to crazy engineers.com .so will u plz tell me how to add a query or doubts in this forum? also reply for how to add my photo. plz reply to my e-id

You are reading an archived discussion.

Related Posts

Bleeding edge browsers and web developers take note, for the latest Firefox 3.5 (previously 3.1) beta is in the wild. There doesn't seem to be much that's entirely whole-cloth new...
Hello, I am a component supplier in an private firm. Recently we are in search of a company that can provide us with all range of precise quality plastic machining...
Hello, I am an ME STudent currently trying to solve a project with MATLAB. First of all let me introduce the problem. I just solved a Differential Equation that gives...
hey guys, i have just bought a standard parallax servo motor. this motor has the same properties as futaba motors. the problem is when i apply the PWM signal to...
HI! Hope to have new friends here!