|
01.07.10 In C++, We Don't Write Our Bugs, We Inherit Them By
Rodney SellersInheritance is one of the concepts on C++ that is difficult to understand and frustrating to track down bugs. Inheritance is when you create a new derived class from a base class. An example would be if you had a base class of employee, it could have basic elements such as pay, schedule, and name. Then, you could have a derived class of manager. It would have all the elements of employee, but could have its own elements such as location, projects, and group. I remember in college some of my professors would have us break up into teams, and each team would make part of a program and inherit something from the team. Tracking down some of the bugs took hours, if not days. If the team next to you didn't do their part, you were left all alone. You had to try to track down the bug and prove that it wasn't your code that was causing the issue. Doing this required long meetings with the professor and the other groups. Ironically, I found this to be very useful when I started working as a coder. How do you handle issues of inheritance? Do you work around them? Do you bring them up to the person who wrote the base class you are using? Do you have access to change the base class yourself? Do you have the time to change the bass class yourself? These are all important questions when you are trying to tackle this issue. I have done each in my time as a coder, and all require significant work on your part. In conclusion, always test your code and make sure it isn't the problem. Also, make sure you are using the class correctly. If you have tested your code and it is working correctly, then you will be fighting an uphill battle to get it corrected.
|
|
| ||
|
-- CProgrammingTrends is an iEntry,
Inc. publication -- iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 2010 iEntry, Inc. All Rights Reserved Privacy Policy Legal archives | advertising info | news headlines | free newsletters | comments/feedback | submit article |