Bool value saying if a device is an endpoint or not
PopBogdan97 opened this issue · 1 comments
PopBogdan97 commented
Since you are already parsing the configuration file, it would be nice to have a bool variable that I can test and which is saying if a device is a router or endpoint (it can be also a Char indicating the type)
zanna-37 commented
You should use this code to achieve what you want (as written in the main.cpp
:
if (auto *router = dynamic_cast<Router *>(device)) {
cout << router->ID << endl;
} else if (auto *endpoint = dynamic_cast<EndPoint *>(device)) {
cout << endpoint->ID << endl;
}