[Solved] Expected identifier or ‘(‘

I don’t quite see the point of another file under the same project just to print powers of three, but that’s possibly your homework. Anyway, I think the whole point is to see how to include a file, so I also isolated the power function in another file. power_calculator.c will accept two parameters, {number} and … Read more

[Solved] How to create a Class inside of a namespace?

classname.h #include <iostream> namespace N { class classname { public: void classmethod(); } } classname.cpp #include “classname.h” namespace N { void classname::classmethod() { std::cout << “classmethod” << std::endl; } } main.cpp #include “classname.h” int main() { N::classname a; classname b; // Error! a.classmethod(); return 0; } solved How to create a Class inside of a … Read more

[Solved] ‘ ‘ was not declared in this scope [closed]

If you want to implement the dynamic array management within a class, you need to qualify your method implementations with the class name. dynamicArray.cpp int * dynamicArray::array_constructor(int * &intPtr, int &size ){ if(intPtr != NULL){ // … other member functions the same thing. However, you don’t really use your class in a class-like way at … Read more