assign a property in a class that contains a static property of another class?
mycl.hpp
class MyClass {
static inline const std::string www = "world net wide";
}
post.cpp
Post::Post(): _type(MyClass::www) {};
wiki.cpp
#include "mycl.hpp"
class Wiki {
std::vector<Post> vec;
}
main.cpp
for (const auto& i: posts) {
std::cout << i->_type << std::endl;
}
The problem is that the values of the _type property are empty, I have assigned the Post class.
The g++ compiler. The pointer method doesn't help, and the std::unique_ptr method doesn't help.
Done
Обсуждают сегодня