Category : interface

I come from Java (OOP) background. I made a simple class to illustrate my problem: #include <list> #include <string> #include <iostream> // classes class InterfaceA { public: virtual std::string functionA(); }; class InterfaceB { public: virtual std::string functionB(); }; class DerivedAB: public InterfaceA, public InterfaceB { public: std::string functionA() { return "I’m a A object"; ..

Read more

class GameObject { public: virtual ~GameObject() {} }; class Player: public GameObject {}; struct IGameController { virtual GameObject* GetPlayer() = 0; }; class CameraOnlyController : public IGameController { public: GameObject* GetPlayer() override { return nullptr; } }; class PlayerController : public IGameController { public: PlayerController() { player = new Player(); } ~PlayerController() { delete player; ..

Read more

I’ve created a COM object in PowerShell using the following code segment and I want to give it an interface (let’s say ‘IFileOperation’), but I don’t know how. I tried multiple things, but nothing works (it’s my first time using PowerShell/COM): $clsid = New-Object Guid ‘3ad05575-8857-4850-9277-11b85bdb8e09’ $type = [Type]::GetTypeFromCLSID($clsid) $object = [Activator]::CreateInstance($type) Get-Member -InputObject $object ..

Read more

In some testing code there’s a helper function like this: auto make_condiment(bool salt, bool pepper, bool oil, bool garlic) { // assumes that first bool is salt, second is pepper, // and so on… // // Make up something according to flags return something; }; which essentially builds up something based on some boolean flags. ..

Read more