I can't use dynamic_cast because I don't know the names of the derived classes. Similarly for std::is_base_of.
1
There are 1 best solutions below
Related Questions in C++
- How to immediately apply DISPLAYCONFIG_SCALING display scaling mode with SetDisplayConfig and DISPLAYCONFIG_PATH_TARGET_INFO
- Why can't I use templates members in its specialization?
- How to fix "Access violation executing location" when using GLFW and GLAD
- Dynamic array of structures in C++/ cannot fill a dynamic array of doubles in structure from dynamic array of structures
- How do I apply the interface concept with the base-class in design?
- File refuses to compile std::erase() even if using -std=g++23
- How can I do a successful map when the number of elements to be mapped is not consistent in Thrust C++
- Can std::bit_cast be applied to an empty object?
- Unexpected inter-thread happens-before relationships from relaxed memory ordering
- How i can move element of dynamic vector in argument of function push_back for dynamic vector
- Brick Breaker Ball Bounce
- Thread-safe lock-free min where both operands can change c++
- Watchdog Timer Reset on ESP32 using Webservers
- How to solve compiler error: no matching function for call to 'dmhFS::dmhFS()' in my case?
- Conda CMAKE CXX Compiler error while compiling Pytorch
Related Questions in HIERARCHY
- Python importing hierarchy failing
- How to parse and group hierarchical list items from an unindented string in Python?
- Creating a function to replace NaN value by traversing up hierarchy columns
- How to shorten line length in react-d3-tree
- hierarchical edge bundle: geom_conn_bundle attribute from another data, over same structure
- hierarchical edge bundle: geom_node_text visualize only the text from the connections
- hierarchical edge bundle ggraph: split "from" the second level connections
- SQL Recursive CTE Lookup in Hierarchy to get a Part Only Flat BOM
- laravel 10 , hierarchy display using 3 models
- How to properly instantiate a tile map in a grid
- How to use scoped slot prop in parent computed
- how to display in react JavaScript a recursive data from MySQL
- How to reposition Albums into correct place in hierarchy
- Output Formatting Issue in Python Code for Employee Hierarchy
- Generate columns based on hierarchy
Related Questions in RADIX
- Multithreading vector multiplication
- Experiencing this error on submit FormatInvalid radix-10 number (at character 1) 162.6 ^ in Flutter
- Hexadecimal radix to sort a list of 4-byte integers
- Radix UI + Next.js Light/Dark Mode Toggle
- Joining a vector and a matrix up in base R
- vite env variables replaced twice with vite command
- Can't Update Python in Anaconda Base Environment
- Shadcn Dialog component margin
- Trying to translate java keyword super to c# keyword base
- Importing Component into Root Component in React Correctly and it is not being rendered
- RadixUI/Shadcn unexpected Portal behaviour (does not reset state)
- How to keep RadixUI Tooltip/Modal in dom
- Interpret string as number; reencode it into another base
- Why does z-index does not work on animated dropdown menu?
- Django error migrating nesting model w/o migrating base model
Related Questions in DERIVED
- How to get null value in Azure Datafactory Derived columns expression builder
- Alternative way to create a in-memory persistent store with derived attribute for Xcode preview(iOS 17+)
- Why do cast hashsets not allow comparisons?
- Python: __init__ of derived Singleton not called
- SSIS Derived Column showing anerror saying out of memory
- How to express a list of objects with a common interface in C++
- Simple SQL query on highest ID
- svelte derived store returns Readable<Writable<boolean> | undefined> value
- How to properly desructure a derived class object when derived class pointer is assigned to base class pointer?
- may be a big problem if I declare a control that derives from CWnd but never use it ? MFC
- FINDSTRING multiple criteria for derived column in SSIS
- Creating bitcoin derived addresses
- Querying derived table in Entity Framework + using aggregates
- WPF C# Derived UserControl Net Core Namespace Does Not Exist
- C# map a list of abstract class objects to derived class for method overloading
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Your question is basically how to check whether the dynamic type of the object that you have (by pointer or reference to
Base) is actuallyBase. This is a job fortypeid:If this test returns false, the object must be of a derived class type (or you messed up somewhere and your program has undefined behaviour).
Note that this works only if
Basecontains at least one virtual function (possibly inherited). If that isn't the case, then there is no way to check.