![]() |
|
#1
|
||||
|
||||
Dealing with virtual functionsWhen running the attached program, I get the errors
Code:
CPP / C++ / C Code:
I vaguely understand why this is happening; because the Color class and subclasses are abstract, the subclasses must provide a definition of the virtual method. But that's what I thought they did, for example: CPP / C++ / C Code:
Now, the colors.h and colors.cpp files were taken from the textbook website, as the actual problem is to use the Colors class hierarchy to create a program that gives the wavelength of light for a given color. The 2 files were originally for a program that used handles to output a table of color properties. If I change the Color* to CPP / C++ / C Code:
Even if I don't use handles, I still get "virtual function" errors if I try to create a Color instance. Is there a correct way to input a color using the Color hierarchy? I've looked through the website's code and corrected what I think were deliberate errors but may have missed some. __________________
Start Programming with Python-A beginner's guide to programming and the Python language. ------------- Common Sense v2.0-Striving to make the world a little bit smarter. |
||||
Recent GIDBlog
Problems with the Navy (Enlisted) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Please help with functions... | brookeville | C++ Forum | 36 | 05-Nov-2004 00:23 |
| conflict between printf and stdarg.h va functions | mirizar | C Programming Language | 3 | 12-Jul-2004 08:11 |
| Another problem dealing with main() and driver function | tommy69 | C Programming Language | 4 | 20-Mar-2004 19:46 |
| Understanding functions | tommy69 | C Programming Language | 15 | 15-Mar-2004 17:59 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The