In object oriented programing, inheritance refers to the ability to create derived classes (or subclasses) of a class. These derived classes can reuse attributes or code defined in the original (or base) class. The subclasses are said to inherit the attributes and methods from their base class. In addition, these new classes can also contain code that is specific to the new class itself. This process allows programmers to reuse common blocks of code while still creating more specific classes. [For more information on classes see the previous story].
"Can you tell me anything more about the visitor?" asked Marcus. He was very worried.
The foreman thought for a moment, but shook his head. "Only that he asked a lot of questions and seemed particularly interested in an outgoing shipment of cheese."
"This is bad," stated Marcus.
"Why?" asked both the cheese minstrel and the foreman.
"The wizard that cursed my cheese did so without knowing what type of cheese it was." Marcus explained.
"So? Is there really a difference in cursing different types of cheese?" asked the cheese minstrel.
"There can be a big difference." answered Marcus. "All classes of cheese are derived from a common 'Cheese' base class. Thus they inherit certain properties and actions. For example, all cheese is created from milk. And all cheese has a weight, density, etc. So to that extent, you could target a spell at the base class of cheese itself. All you would need to know is that you are dealing with some class of cheese."
"But, in addition to the inherited properties, each class of cheese has properties of its own." continued Marcus. "For example, some cheeses cause a little popping sensation when eaten."
"Likely Patagonian Popper?" asked the cheese minstrel. Honestly, he was more interested in the cheese aspect of this story than in the magic spells.
"Yes. Exactly." confirmed Marcus. "Knowing which subclass you are dealing with has certain advantages. For example, you can tailor your spell to easily hide within the specific properties of the cheese. In this case, I thought that the wizard who cast this spell was explicitly using the fact it was bleu cheese."
"But since we do not label the boxes with cheese type, the wizard must not have known what cheese he was dealing with." finished the foreman.
"Yes. And that means that we have a very sophisticated wizard on our hands." confirmed Marcus. "Since the shipping labels have the names on them, he could also target my cheese directly. Was anyone else here that might have seen him?"
"Only Sam, the logistics manager." answered the foreman. "But he is having some personal issues at the moment."
"What sort of issues?" asked Marcus.
"He became unnaturally obsessed with some salesman routing problem. He claimed that he could revolutionize my cheese sales if he just solved it. But after 2 weeks, he had not made any progress. I finally had to send him home."
"The traveling salesman problem." Marcus whispered under his breadth. Then louder: "When did this start?"
The manager thought for a moment. "You know, it was right after that visitor."
Marcus nodded. "I have seen this curse before -- the spell of Unnatural P=NP Obsession. It is a powerful spell. Luckily for you, I am one of three wizards in the kingdom that can break this spell."
The moment he said those words, Marcus realized a few things. First, he knew why he had been targeted with cursed cheese. Second, the kingdom was in grave danger. Third, and most shocking, he was not longer hungry for cheese.
See how the saga of the cursed cheese began with Part 1: Data Validation, Marcus, and the Cheese Minstrel. Or read about Ann's discover of the spell of Unnatural P=NP Obsession during her trip to G'Raph.
Or if you think the cheese minstrel has it bad, also check out the plight of the king's hedgehog walker in The Incident at the North Gate (or Why = is not ==).
Want more updates and commentary? Follow CompFairyTales on Twitter or follow the author (Jeremy Kubica) on Google+.