本文介绍了vb作业问题 - 帮助理解循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 考虑一个声明了名为  学生的数组,其大小为10。  此数组包含班级中所有10名学生的的姓氏。  然后可以遍历此数组并打印出所有姓氏。  如果使用单独的变量名称(student1,student2,student3 ......等)代替数组,为什么这不可能?  解释Consider an array named students of size 10 is declared.  This array holds the last name of all 10 students in the class.  It would then be possible to loop through this array and print out all the last names.  Why would this not be possible if using separate variable names (student1, student2, student3...etc.) in place of the array?  Explain推荐答案 https://www.codeguru.com/vb/gen/vb_misc/oop/article.php/c7063/Data-Transfer-Object-Pattern -Goes-VBNET.htmhttps://www.codeguru.com/vb/gen/vb_misc/oop/article.php/c7063/Data-Transfer-Object-Pattern-Goes-VBNET.htm自定义类型可以使用具有自己的私有后备变量的auto属性,该变量通过其公共属性公开。The custom type can be using auto propertie that has its own private backing variable, that is exposed through its public property. https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/procedures/auto-implemented-propertieshttps://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/procedures/auto-implemented-properties但是在另一方面,您也不必使用自定义类型,类。你可以在List(of T)中使用 primitive 类型的string,int,double和其他原始类型。But on the other hand, you don't have to use a custom type, a class, either. You can usingprimitive type string, int, double, and the others primitive types too in a List(of T). https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/concepts/collectionshttps://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/concepts/collections< copied><copied> 对于 列表< T> ,您也可以定义自己的类。在以下示例中, Galaxy List< T> 在中定义< end><end>银河系是自定义类型,即DTO,一个使用公共属性的对象。The Galaxy is that custom type, that DTO, an object using public properties. https://www.dotnetperls.com/property-vbnethttps://www.dotnetperls.com/property-vbnet什么你被教导是面向对象编程的支柱之一。What you are being taught is one of the pillars of object oriented programming. https://standardofnorms.wordpress.com/2012/09/02/4-pillars-of-object-oriented -programming /https://standardofnorms.wordpress.com/2012/09/02/4-pillars-of-object-oriented-programming/ https://en.wikipedia.org/wiki/Encapsulation_(computer_programming)https://en.wikipedia.org/wiki/Encapsulation_(computer_programming)< copied><copied> 封装 是OOP的基础 ( 面向对象的编程 )。 它指的是使用对该数据进行操作的方法捆绑数据。< sup class =" reference" ID = QUOT; cite_ref-Rogers01_5-1"风格= QUOT;背景色:透明;颜色:#222222;字体家庭:无衬线;字体大小:9.26px;字型样式:正常;字体变量:正常;字体重量:400;信纸间距:正常;行高:9.26px;孤儿:2;文本对齐:左;文字修饰:无;文本缩进:0像素;文字变换:无; -webkit文本行程宽度:0像素; white-space:nowrap;字间距:0px;"> [5] < / sup> 封装 用于隐藏类 中结构化数据对象的值或状态,防止未授权方直接访问它们。通常可以在类中提供可公开访问的方法(所谓的 getters 和 setters )访问值,其他客户端类调用这些方法来检索和修改对象中的值。Encapsulation is one of the fundamentals of OOP (object-oriented programming).It refers to the bundling of data with the methods that operate on that data.<sup class="reference" id="cite_ref-Rogers01_5-1" style="background-color:transparent;color:#222222;font-family:sans-serif;font-size:9.26px;font-style:normal;font-variant:normal;font-weight:400;letter-spacing:normal;line-height:9.26px;orphans:2;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;-webkit-text-stroke-width:0px;white-space:nowrap;word-spacing:0px;">[5]</sup> Encapsulation is used to hide the values or state of a structured data object inside a class, preventing unauthorized parties' direct access to them. Publicly accessible methods are generally provided in the class (so-calledgetters and setters) to access the values, and other client classes call these methods to retrieve and modify the values within the object.< end><end> Capiche? 这篇关于vb作业问题 - 帮助理解循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-15 13:33
查看更多