So far we’ve had C++ classes that derive from other classes, but not their interfaces. Today we’ll make C++ classes implement all their interfaces to form a full type hierarchy. Along the way we’ll learn about how inheritance works in C++, specifically the esoteric form known as “virtual inheritance.”
Posts Tagged inheritance
There are lots of ways to check the type of an object in AS3. These include the
is operator, the deprecated
instanceof operator, the
constructor field, and a combination of
getDefinitionByName. Which is fastest, cleanest, and most effective? Today’s article puts them all to the test to find out!
If you want to check if one class inherits another without actually having instances of those classes, you may have read my article on Checking Class Inheritance. However, as the many comments quickly pointed out, the methods of checking this may have some flaws. There were also additional methods posted in the comments that should be added and tested. Today I’m adding them, testing them, and checking all of their validity to find the ultimate approach to check class inheritance.
I recently received a tip about a thread discussing an interesting problem: how to tell if one
Class object represents a class that subclasses another
Class object. If you had an instance of the class, you could simply use the
instanceof keywords, but that won’t do here. Today’s article shows how to solve this tricky problem.
Last Friday’s article expressed some longing for C-style function pointers. It attempted to use AS3’s Namespace class to fake a function pointer. Unfortunately, this resulted in far slower code than simple direct access. Today’s article shows a technique that actually results in far faster code!