#include <iostream> class Hello { public: void Test() { std::cout << "Testing" << std::endl; } }; class Hi { public: Hi() :hello(new Hello()) {} ~Hi() { delete hello; } void Testing() const { hello->Test(); } private: Hello * hello; }; int main(int argc, char ** argv) { Hi hi; ; hi.Testing(); return 0; } As i know a non-constant member function cant be called inside a constant member function but how the above code has been compiled successfully and giving the expected result .
View Tag Cloud
Forum Rules
Bookmarks