what is the definition of method abstraction code example

Example: method abstraction

// Method abstraction is the practice of reducing inter-dependency between methods.  
 // The following is an unreasonably simple example, but the point stands: 
 // don't make the person on the other side of your function do more work 
 // than they need to.  Include all necessary data transformations in your 
 // methods as is.  For instance, take method GetAreaOfCircle: 

 // Good practice: 
float GetAreaOfCircle(float radius) {
	return 3.14f * radius * radius;
}
int main() {
	printf("%d", GetAreaOfCircle(3.0f));
    getch();
    return 0;
}

 // Bad practice: 
float GetAreaOfCircle(float radius) {
	return radius * radius;
}
int main() {
	float area = 3.14f * GetAreaOfCircle(3.0f);
	printf("%d", );
    getch();
    return 0;
}

Tags:

C Example