class AbstractSCP *scp;
doConnect(scp) {...} // this function is NOT called, it just exists to establish a connection if needed. scp gets initilized in here
checkConnected(scp) {
if (!scp) { popMessage("Not connected!"); } // this always gets evaluated as true, why? What's the correct way to check this?
else { doSomething(scp); } // And since the first one evaluates as true, this here crashes the program.
}
I tried adding a member bool AbstractSCP::connected and set it to false when initializing the constructor, but it still evaluates as true because the constructor is not called. (I assume?)
I tried using if(scp == NULL) { popMessage("Not connected"); } without success. Any responses are appreciated!
I managed to workaround with a constructor that doesn't require arguments (the constructor for AbstractSCP requires hostname, username, password and port). So I just created a default one
as