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 class
Now that we have complete support overriding everything—methods, properties, indexers, events—that can be overridden in a base class or interface, there’s a bit of tidying up to do. In today’s article, we’ll take steps to make base types much more useful by inserting them into their proper place in the type hierarchy.
Today we’ll complete our ability to use C++ classes to derive from C# classes and implement C# interfaces. So far we’ve been able to override methods, properties, and indexers. Today we’ll add the ability to override events and derive from classes that don’t have a default constructor.
Those are the last two pieces of the puzzle that will allow us to derive from any C# base type with a C++ class. Read on for all the details about how this works.
We code in C#, but that’s just a starting point. Our C# code is compiled to DLLs and then converted into C++ where it’s compiled again to machine code. The good news is that this isn’t a black box! I’ve recently been reading through the C++ code that IL2CPP outputs and learning quite a lot. Today’s article is about some of the surprises that I encountered and how you can change your C# code to avoid some nasty pitfalls.
Most programmers write code for an abstract computer. The thing is- code runs on a real computer that works in a specific way. Even if your game is going to run on a wide range of devices, knowing some of the common features can speed up your code 10x or more. Today’s article shows you how!
Iterator functions and their ability to
yield return values then continue on really come in handy for a variety of situations. Unfortunately, they come with some pretty serious performance and garbage creation drawbacks. So today’s article explores alternatives in various forms of callbacks: delegates, interfaces, and classes. Can they perform better than iterator functions? Can they avoid garbage creation? Read on to find out!
When writing code for a library, there is invariably some of it you want to hide from the users of the library. You want to keep the public API clean, but Unity makes this tough. Today’s article discusses a strategy for laying out your code so that users of the library aren’t burdened by classes, functions, and properties that they don’t need to know about. Read on to see how!