Today we’ll cover the last major topic of structs in C++: how we control access to them. We’ll talk about access specifiers like private
, the “friendship” concept, and finally get around to the details of const
.
Posts Tagged inheritance
Now that we know how to initialize structs and other types in C++, we can take a look at inheritance and learn how to make structs derive from each other. There’s a lot of extended functionality here compared to C# class inheritance. Read on to learn the basics as well as advanced features like multiple inheritance and virtual inheritance!
Now that we’ve seen how function pointers work and perform in Burst, let’s use them to build a higher-level feature: virtual functions!
Since their introduction in part 7, support for C++ MonoBehaviour
messages has always been a special case. The reason for this was that we didn’t have good enough support for what I’m calling “factory functions.” These are functions like GameObject.AddComponent<T>
that instantiate a generic type. This week we’ll go over why that support was lacking, what was done to fix it, and how the new system works.
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.”
Let’s continue the From AS3 to C# series from last time by continuing to investigate C# classes from an AS3 developer’s point of view. Today’s article will cover class inheritance, interface implementing, and interface 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 getQualifiedClassName
and 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 is
or 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!