Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
RTTI Test
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
//Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x64 #include <iostream> #include <typeinfo> class A { public: A() {} virtual ~A() {} }; class B : public A { }; int main() { A* aa = new A(); A* ab = new B(); B* bb = new B(); std::cout << typeid(aa).name() << std::endl; std::cout << typeid(*aa).name() << std::endl; std::cout << typeid(ab).name() << std::endl; std::cout << typeid(*ab).name() << std::endl; std::cout << typeid(bb).name() << std::endl; std::cout << typeid(*bb).name() << std::endl; std::cout << (aa == dynamic_cast<B*>(aa)) << std::endl; std::cout << (ab == dynamic_cast<B*>(ab)) << std::endl; std::cout << (bb == dynamic_cast<B*>(bb)) << std::endl; }
cl.exe
Show compiler warnings
[
+
] Compiler args
[
+
]
Show input
Compilation time: 1,8 sec, absolute running time: 0,32 sec, absolute service time: 2,14 sec
edit mode
|
history
|
discussion
class A * __ptr64 class A class A * __ptr64 class B class B * __ptr64 class B 0 1 1