Skip to content

An example of the safely shifting through the class hierarchy using static_cast

License

Notifications You must be signed in to change notification settings

ystanislavyk/DoubleDispatch

Repository files navigation

Build Status

DoubleDispatch

Problem

There is an interface with some count of the implementations. Need to use these implementations through the interface with one limitation - without RTTI mechanism in the "release".

In this repository considered a three ways of solving such case using static_cast and the Double Dispatch pattern in particular.

Platform

  • Linux (Ubuntu is pref)
  • macOS

System Requirements

macOS

To build for macOS, you need Xcode. You will also need CMake and Conan.

Homebrew

brew install cmake conan

Linux

For Ubuntu, you'll need the following dependencies:

sudo apt-get install g   cmake clang clang-format clang-tidy libclang-dev python-pip conan 

Build

Build commands

By default used GCC compiler and Debug mode. Clang is also supported

Run one of the following commands to build project

make or make gcc-debug - build project with GCC in Debug mode

make gcc-release - build project with GCC in Release mode

make clang-debug - build project with Clang in Debug mode

make clang-release - build project with Clang in Release mode

make all - build project with GCC and Clang in Debug and Release modes

make clean - removes the build folder

Run

Run from build directory

ctest

or

ctest AllTests

About

An example of the safely shifting through the class hierarchy using static_cast

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published