Difference between Private Sub, Function and Class

Furqan Sehgal picture Furqan Sehgal · Oct 30, 2010 · Viewed 90.6k times · Source

What are the differences between the following:

  • Private Sub
  • Private Function
  • Private Class

When should each one be used?

Answer

xpda picture xpda · Oct 31, 2010

Private is a modifier than gives the scope of the class, sub, or function.

A sub and a function are both subroutines, or sections of code that can be called in the program. The difference between them is that a function has a return value and a sub does not.

A class is a group of codes that can include subs, functions, and other stuff.