xref: /llvm-project/lldb/test/API/functionalities/dynamic_value_child_count/pass-to-base.cpp (revision 99451b4453688a94c6014cac233d371ab4cc342d)
1 #include <stdio.h>
2 #include <memory>
3 
4 class BaseClass
5 {
6 public:
7     BaseClass();
~BaseClass()8     virtual ~BaseClass() { }
9 };
10 
11 class DerivedClass : public BaseClass
12 {
13 public:
14     DerivedClass();
~DerivedClass()15     virtual ~DerivedClass() { }
16 protected:
17     int mem;
18 };
19 
BaseClass()20 BaseClass::BaseClass()
21 {
22 }
23 
DerivedClass()24 DerivedClass::DerivedClass() : BaseClass()
25 {
26     mem = 101;
27 }
28 
29 int
main(int argc,char ** argv)30 main (int argc, char **argv)
31 {
32   BaseClass *b = nullptr; // Break here and check b has 0 children
33   b = new DerivedClass();  // Break here and check b still has 0 children
34   b = nullptr;  // Break here and check b has one child now
35   return 0; // Break here and check b has 0 children again
36 }
37