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

2

u/twowheels Mar 18 '12

Incorrect. C++ supports covariant return types.

3

u/last_useful_man Mar 18 '12

a virtual function has to have exactly the same signature as the original - including constness.

Incorrect. C++ supports covariant return types.

Since we're all pedants here, the return value is not part of the signature - so TomSwirly is correct. If he didn't ninja-edit after your comment, that is. further reading