polymorphism

hi, i'm experimenting with polymorphism in arduino, but I'm getting the following error message:

bi_grafic.cpp.o: In function gr_routine': C:\Users\JUANCA~1\AppData\Local\Temp\build4041774866979188726.tmp/bi_grafic.cpp:116: undefined reference tovtable for gr_routine' C:\Users\JUANCA~1\AppData\Local\Temp\build4041774866979188726.tmp/bi_grafic.cpp:116: undefined reference to `vtable for gr_routine'

does anybody know why :drooling_face:

thanks in advance

bi_grafic.h

class gr_routine {

  public:
  
  gr_routine();
  gr_routine(  uint8_t* driver_in  );
    
  virtual void execute();
    
protected:

  uint8_t* gr_driver;
  

};





class routine_a : public gr_routine { 

public:

  routine_a(  uint8_t* driver_in  ) ;
  
  virtual void execute();

private:

  int  a_counter1;
  int  a_counter2;
  int  a_counter3;
  
  uint8_t* gr_driver;
  
};

bi_grafic.cpp

gr_routine::gr_routine(  uint8_t* driver_in  )  {
  
  gr_driver = driver_in;

}


gr_routine::gr_routine(    ) {
    
  Serial.println("gr_routine_called");
  
}



routine_a::routine_a(  uint8_t* driver_in  ) :  gr_routine()  {
  
  a_counter1 = 1;
  a_counter2 = 2;
  a_counter3 = 3;
  
  gr_driver = driver_in;
  
}


void routine_a::execute(){

  if (a_counter1 > 7) {     a_counter1 = 0;   }
  if (a_counter2 > 7) {     a_counter2 = 0;   }
  if (a_counter3 > 7) {     a_counter3 = 0;   }

/* here comes some more code */

    a_counter1++;
    a_counter2++;
    a_counter3++; 

}
routine_a::routine_a(  uint8_t* driver_in  ) :  gr_routine()  {

Where is this class defined?

  virtual void execute();

You don't appear to have an classes that derive from gr_routine, so why is execute a virtual function? The vtable message says that you don't have any definition anywhere for this virtual function to be looked up.

thanks, I added the following code and now it started to work.

I will have a number of routines which share some data but have different "execute" functions (in the future) ;)

void gr_routine::execute(    ) {
    
  return;
  
}