online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <iostream> #include "R.hpp" #include "S.hpp" #include <memory> int main() { auto s = std::make_shared<n1::n2::S>(); auto r = std::make_shared<n1::c1::R>(s); r->r(); //s.print(); return 0; }
#ifndef S_H #define S_H #include <memory> namespace n1 { namespace c1 { class R; } } namespace n1 { namespace n2 { class S { friend class c1::R; int x; void print(); }; // using Sptr = std::shared_ptr<S>; } } #endif
#include "S.hpp" //#include "R.hpp" #include <iostream> namespace n1 { namespace n2 { void S::print() { std::cout<<"S-print\n"; } } }
#ifndef R_H #define R_H #include <memory> namespace n1 { namespace n2 { class S; using Sptr = std::shared_ptr<S>; } } namespace n1 { namespace c1 { class S; struct R { R(n1::n2::Sptr s); void r(); n1::n2::Sptr s_; }; } } #endif
#include "R.hpp" #include "S.hpp" namespace n1 { namespace c1 { R::R(n1::n2::Sptr s):s_(s) {} void R::r() { s_->print(); } } }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue