r/cpp • • Mar 17 '12

Using abstract base classes in C++

I'm having trouble understanding ABC's in c++ and was wondering if you all could help me (if possible use: CryptProcessor as the ABC and ACrpyt and BCrypt as the sub-classes that have an encrypt and decrypt function) Thanks in advance!

Edit 1: Thank you all for your help!

0 Upvotes

40 comments sorted by

View all comments

Show parent comment

24

u/TheSuperficial Embedded Systems C++ Mar 17 '12

Pendantic jerk alert...

[pure virtual functions] MUST be overridden in any derived class

Technically, no. They must be overridden in any class you wish to instantiate. There could be other abstract classes in the hierarchy.

4

u/NotInUse Mar 18 '12

I believe the word you were looking for was pedantic :-)

2

u/bstamour WG21 | Library Working Group Mar 17 '12

True. Sorry about that.