Inheritance, virtual function... or something?

I’ve written a fairly big library which deals with potentiometers, buttons, LEDs, MIDI etc. Now, there is a part of that library which deals directly with hardware. I’ve managed to “separate” that part from library and I’ve put the hardware control functions within my main.cpp (I’m not using any Arduino libs). Here’s how it works:

This is a function which switches columns in a matrix (in my library):

void OpenDeck::nextColumn()   {
	
	sendLEDrowsOffCallback();
	
	if (column == _numberOfColumns)	column = 0;
	
	sendColumnSwitchCallback(column);
	
	//increment column
	column++;

}

So, before switching to another column, it first turns off all LED rows off, and then activates next column. So, where are those functions? Within my main.cpp. I’ve used callbacks to handle this:

openDeck.setHandleColumnSwitch(activateColumn);
openDeck.setHandleLEDrowsOff(ledRowsOff);

...	
...
...

//switch to next matrix column
void activateColumn(uint8_t column)  {
	
	//column switching is controlled by 74HC238 decoder
	PORTC &= 0b11000111;
	PORTC |= (0b11000111 | (column << 3));
	
}

//control select pins on mux
void setMuxOutput(uint8_t muxInput)	{
	
	PORTC &= 0b11111000;
	PORTC |= muxInput;
	
}

There are way more functions dealing with hardware, but this should be enough for an example. So, while this works, I find it be a bit tedious: I have to set callback handler, implement it, and also write a chunk of code within my library to make that stuff work. Is there a better way for achieving this? I remember when we coded in Java on college couple of years ago, I don’t remember how was it called, but you could define a function in your library with a certain keyword, and any time you made an object in your main program, you had to implement that function. Is something like that possible in AVR C?

I was just reading about this last night. In Java it's called an interface and I wanted to know how to do that in C++. What I learned was that the concept of an interface is moot in C++ because C++ allows for multiple inheritance. So what you want is indeed virtual functions. It's not quite as straightforward and idiot proof as an interface is in Java. You have to watch out for who inherits what and from whom.

Virtual functions sounded good to me until I found out (well, that is at least what all the examples I've found are showing) their use is when you want to create a derived class from your base class. I don't want to do that. I only have one class.