[Solved] Where and how to define member variables? In header or implementation file?
You don’t need to re-declare the class in the .cpp file. You only need to implement its member functions: #include “Mems.h” #include <iostream> // only required for the std::cout, std::endl example Mems::Mems() : n(42) // n initialized to 42 { std::cout << “Mems default constructor, n = ” << n << std::endl; } Note that … Read more