Comment avoir deux fonctions qui s’appellent C ++

J’ai 2 fonctions comme celle-ci qui obscurcit la boucle if:

void funcA(ssortingng str) { size_t f = str.find("if"); if(f!=ssortingng::npos) { funcB(str); //obfuscate if-loop } } void funcB(ssortingng str) { //obfuscate if loop funcA(body_of_if_loop); //to check if there is a nested if-loop } 

Le problème avec ceci serait que funcA ne pourrait pas voir funcB et vice versa si je mettais funcB avant funcA .

J’apprécierais toute aide ou conseil ici.

Ce que vous voulez, c’est une déclaration anticipée . Dans ton cas:

 void funcB(ssortingng str); void funcA(ssortingng str) { size_t f = str.find("if"); if(f!=ssortingng::npos) { funcB(str); //obfuscate if-loop } } void funcB(ssortingng str) { //obfuscate if loop funcA(body_of_if_loop); //to check if there is a nested if-loop } 

Une déclaration anticipée fonctionnerait:

 void funcB(ssortingng str); void funcA(ssortingng str) { size_t f = str.find("if"); if(f!=ssortingng::npos) { funcB(str); //obfuscate if-loop } } void funcB(ssortingng str) { //obfuscate if loop funcA(body_of_if_loop); //to check if there is a nested if-loop }