Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

When we use function and when we use class? Answer in one line

user-image
Question added by Ahmed Gamal Soliman , Senior java devoloper , Hideleco
Date Posted: 2017/03/27
Muhammad Rehan
by Muhammad Rehan , Senior Software Engineer , Ascertia

Functions are used to DO specific things, whereas classes ARE specific things (class is a way of grouping functions (as methods) )

Ahmed Gamal Soliman
by Ahmed Gamal Soliman , Senior java devoloper , Hideleco

I accept answer of mr mohamed rehan

I think function we use when we need to deal with one task as power function- loop function then class we use when we need to deal with multi taskesin many form

Amany Saad Abolella
by Amany Saad Abolella , Senior PHP Developer , Speedi

Functions are the meat of your application and classes are more like the plate. It's messy to eat meat without a plate. But if you don't have any meat, you don't have a meal.

 If you want to represent data as objects use classes.

If you want a quick solution use function.

 

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.