Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

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

user-image
Question ajoutée par Ahmed Gamal Soliman , Senior java devoloper , Hideleco
Date de publication: 2017/03/27
Muhammad Rehan
par 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
par 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
par 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

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?