vb.net Private Sub、Function 和 Class 之间的区别
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4059537/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Difference between Private Sub, Function and Class
提问by Furqan Sehgal
What are the differences between the following:
以下有什么区别:
- Private Sub
- Private Function
- Private Class
- 私人潜艇
- 私有函数
- 私人班
When should each one be used?
应该什么时候使用?
回答by xpda
Private is a modifier than gives the scope of the class, sub, or function.
Private 是一个修饰符,而不是给出类、子或函数的范围。
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.
sub 和 function 都是子例程,或可以在程序中调用的代码段。它们之间的区别在于函数有返回值而子函数没有。
A class is a group of codes that can include subs, functions, and other stuff.
类是一组代码,可以包括子、函数和其他东西。
回答by Alejandro
Sub is like a function but it doesnt returns any values it just executes a proccess
Sub 就像一个函数,但它不返回任何值,它只是执行一个过程
回答by A_Nabelsi
Class is a Class, Sub and Function are methods, private is an access modifier
Class 是类,Sub 和 Function 是方法,private 是访问修饰符
now check this link,
现在检查这个链接,