Stub Functions

A stub is just an empty function. It's a quick way to create a skeleton of your final program.

You may add the print output to ensure that all your stubs get implemented.

Your stubs may or may not take an argument but they usually will return something.

Stub functions are typically functions which have been defined but have no real code in them. For example the function below might be a stub...

string printMessage() {
   return "";
}

This function really does nothing but return an empty string. It is a stub, as in a place where we will fill in code later but have not done it yet. You may also know these as "skeleton functions". They are meant as place holders and in some systems they may even have you create a stub function that when linked with a library it will encounter the stub and fill in the details turning the stub above into something like...

string printMessage() {
   return "Hello from my a library";
}

猜你喜欢

转载自www.cnblogs.com/JasperZhao/p/12898155.html