This semester (my final semester at VCU), I am taking INFO 450: Advanced Programming, which concentrates in C++. We’re learning both native and managed C++. Our first assignment was simple: a console application to calculate the monthly payments on a car loan, based on interest rate, total loan, and loan duration. That was pretty easy.
This assignment was pretty rough. We had to code a fully functional ATM application, which uses a hardcoded bank database, accounts, authentication, withdrawal & deposit simulation, etc. We were told that we could mirror the ATM case study at the end of our Learn to Program C# 2005 by Deitel (the book from intermediate programming).
After mirroring the C# code, I kept getting error after error. It was ridiculous how every error stemmed from how header files were used in my code. Eventually, I worked out the problems with the header files. Then, I kept getting this compiler error: LNK2019. I searched and searched online, and couldn’t find a suitable answer. Finally, I retraced all my code, and realized that I had three classes (Withdrawal, Deposit, BalanceInquiry) all overriding the virtual function ‘Execute’ from class Transaction, but that class wasn’t marked virtual. This probably should have been the first place I looked, but keep in mind we were given this assignment the day after we learned about references.
To make a long story short, I was receiving LNK2019 errors because of my virtual functions. The error was caused by declaring the function as “virtual void Execute();” instead of “virtual void Execute() = 0;” Embarrassingly, that little mistake took me forever to figure out. I somewhat hope that whatever path I take in the future uses tools with less cryptic error messages.