Skip to content

Instantly share code, notes, and snippets.

@jerstlouis
Created July 22, 2014 01:00
Show Gist options
  • Save jerstlouis/e9846f70664116564f45 to your computer and use it in GitHub Desktop.
Save jerstlouis/e9846f70664116564f45 to your computer and use it in GitHub Desktop.
class Engine
{
virtual void ::spec(any_object object);
}
class Wheel
{
virtual void ::nos(any_object object);
}
class CarWheel : Wheel
{
void spec(Car car)
{
}
}
class CarEngine : Engine
{
void nos(Car car)
{
}
}
class Car
{
subclass(Engine) engine; engine = class(CarEngine);
subclass(Wheel) wheel; wheel = class(CarWheel);
}
void SomethingThatDealsWithAnEngine(subclass(Engine) engineClass, any_object i)
{
engineClass.spec(i);
}
void Test()
{
Car car { };
SomethingThatDealsWithAnEngine(car.engine, car);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment