classes inheritance

Pages: 12
.
Last edited on
It appears that the Senator class has changed. But it is a good thing you can use virtual functions. I will try to help you when I get up but in the mean time others can join in too.
As cire stated before, I can do it this way but I don't know how to properly implement virtual functions.

Also, thank you Mantorr22 for your help!
Last edited on
But when I do that I get an error.

If that's all you changed...


'Senator': no appropriate default constructor available
You removed the default constructor.


If you left the Senator::getEncryption definition as it is while changing the class definition, that would explain all of:
'mostFreqLetter': identifier not found
'ShiftedCipher': identifier not found
'fillDictionary': identifier not found
'Albahri': cannot instantiate abstract class


Senator::getEncryption and Senator::getDecryption don't require a defintion.
Albahri::getEncryption and Albahri::getDecryption do.

And, then, of course, you need to modify your main so that it is actually dealing with an Albahri instance and not just a Senator instance.
Okay. I understood what's the problem now. Thank you cire!

This article helped: http://www.learncpp.com/cpp-tutorial/126-pure-virtual-functions-abstract-base-classes-and-interface-classes/

a pure virtual function is a function that can be implemented by a derived class. In other words, I needed to add the definition of the functions in Albahri.h and remove "= 0" and provide the body for them in the source.cpp file as string Albahri::function().

Along with your help, ofcourse.

Thanks.
Last edited on
Topic archived. No new replies allowed.
Pages: 12