# Using virtual member functions

**URL:** <https://www.ruby-forum.com/t/using-virtual-member-functions/234555>\
**Category:** GNU Radio\
**Created:** [March 13, 2015, 2:17pm UTC](https://www.ruby-forum.com/t/using-virtual-member-functions/234555 "2015-03-13T14:17:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [March 13, 2015, 2:17pm UTC](https://www.ruby-forum.com/t/using-virtual-member-functions/234555/1 "2015-03-13T14:17:03Z")

</div>

Hello all,

I’m about to use member functions of the abstract base class of qtgui  
classes to adjust visualization parameters such as “set\_title”,  
“set\_line\_label”  
etc.

There is an explanation of virtual based classes in [1]. So it’s  
possible  
to use pure virtual functions by the derived classes.

When we’re in GNURadio, there is an abstract class and an implementation  
class which is derived from the abstract class. So I expect to be able  
of  
using the pure virtual functions declared in abstract class by having a  
pointer of the implementation class. However the members aren’t  
accessible.  
What can I do to use them?

Best,  
Mostafa

[1] [http://www.cplusplus.com/doc/tutorial/polymorphism/](http://www.cplusplus.com/doc/tutorial/polymorphism/)

---

<div class="post-metadata">

**Author:** ![mostafa\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/5e9695/32.png) [@mostafa\_a](https://www.ruby-forum.com/u/mostafa_a)\
**Post date:** [March 13, 2015, 6:31pm UTC](https://www.ruby-forum.com/t/using-virtual-member-functions/234555/2 "2015-03-13T18:31:47Z")

</div>

When you ‘make’ a block, it actually returns you a \_impl version of the  
class, even though only the abstract class is declared publically. All  
the methods are actually defined in the \_impl, where also the members  
reside.

If you’re having trouble understanding the polymorphism concepts, I  
suggest having another look at some C++ literature. If it’s the actual  
GNU Radio block design, have another look at examples of blocks (e.g. in  
gr-blocks) to see how the abstract methods interact with their  
definitions.

Cheers,  
M
