zanna-37/BGP-simulation

Bool value saying if a device is an endpoint or not

PopBogdan97 opened this issue · 1 comments

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)

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;
}