您好,欢迎访问三七文档
当前位置:首页 > 临时分类 > 《Beginning-C#-Objects中文版-概念到代码》
BeginningC#ObjectsObjectsandClasses(Object)(Class)(Object-OrientedOO)2llll3.1Merriam-WebstersCollegiateDictionary(1)(2)3BeginningC#Objects(StudentRegistrationSystem,SRS)llllllSRSllll3.2(State)/Attribute()/(Data)ll(ID)llllGPA6970BeginningC#Objectsl(facultyadvisor)l(courseload)l/lART101llllattributeattribute.NETC#attribute.NETattribute.NETfield/attribute13C#(.NET)attributeattributeOOattribute(state)lattributelattributeattributeattributeGPA,C#3.3(Behavior)/Operations/(Methods)71BeginningC#Objectslll(majorfieldofstudy)l(advisor)lGPAl,,lllllloperationsattributeattributeattribrtelGPAGPAattributelattributelattributeattributeC#method7273BeginningC#Objects3.4(ClassclassStudentlattributelStudent3-1attribute3-1attributeattributenamestringstudentidstringbirthdateDateTimeaddressstringmajorstinggpadoubleadvisor???courseLoad???transcript???StudentattributeattributeC#StringdoubleDateTimeattributeadvisor,courseLoadtranscriptattributeStudentlRegisterForCourselDropCourselChooseMajorlChangeAdvisorlPrintTranscriptDVDDVD7475BeginningC#Objectsfeaturememberattributeattribute/OOC#OOC#attributeC#attribute3.4.1Student,Course,ProfessorcoursecatalogCourseCatalogPascalPascalcasingC#PascalMain,GetNameRegisterForCourseattributeC#attributename,studentIdcourseLoadCamelCamelcasimgPascalCamel3.4.2Instantiationlattributel(instantiation)Student(instance)StudentStudentC#76BeginningC#Objectslattribute(template)3-1lattribute3-23-1attribute3-2attribute77BeginningC#Objects3.4.2.1(Encapsulation)(Encapsulation)field(method)OOOOCCstructstructemployee{charname[30];intage;}Cfloataverage(floatx,floaty){return(x+y)/2.0;}OO3.5(User-definedType)(ReferenceVariable)COOintx;x(integer)Clxlxint(+)(-)(*)(/)(=)lxif(x17)x=x+5;C#StudentStudenty;lyStudentStudentlyStudent78BeginningC#Objectsly//if(yhasn'tchosenanadvisoryet)Console.WriteLine(Uhoh...);StudentyintxintCC#Studentuser-definedtypeyStudentreferencevariableattributePascalStudentx;StudentaStudent;CourseprerequisiteOfThisCourse;ProfessormyAdvisor;3.6OOC#Studenty;StudentyStudentnull1nullC#C#newStudentyy=newStudent();y4(constructor)3-37980BeginningC#Objects3-3handleyStudentnewStudent();Studenty=newStudent();//StudentStudentx=newStudent();//StudentStudenty;//yy//xy=x;3-481BeginningC#Objects3-4/3-53-63-73-5//Studentx=newStudent();//82BeginningC#ObjectsStudenty;//xy//x//y=x;//Studentz=newStudent();//yStudentStudenty=z;3-6xStudent////x=z;3-783BeginningC#ObjectsC++C++C#.NETCLRcommonlanguageruntime133.7attributeStudentattributeattributeC#advisorcourseLoadtranscriptStudentadvisorattributeProfessor3-2string3-2Studentattribute2attributenamestringstudentIDstringbirthdateDateTimeaddressstringmajorstringgpadoubleadvisorProfessorcourseLoad???transcript???advisorattributeProfessoradvisorattributeStudentProfessorcourseLoadtranscriptProfessor3-3attribute3-3ProfessorattributeattributenamestringemployeeIDstringbirthdateDateTimeaddressstringworksForstring(Department)studentAdviseeStudentteachingAssignments???BeginningC#ObjectsProfessorstudentAdviseeattributeStudentstudentAdviseeattributeProfessor/StudentteachingAssignmentsattributeProfessor1.TransferToDepartment2.AdviseStudent3.AgreeToTeachCourse4.AssignGradesProfessorlstudentAdviseeattributeStudent6collectionsProfessorteachingAssignmentsattributeStudentcourseLoadtranscriptattributelworksForattributestringMATHDepartmentDepartmentDepartmentattribute//3.8StudentProfessorattribute(composition)OO3-886BeginningC#Objects3-8OOOOABllSRSGradeBookGradeBookattributeCourseGradeBookGradeBookCourseGradeBookStudentCourseCourseGradeBookStudentStudentProfessorABBAattributeAattributeB3-987BeginningC#Objects3-9/StudentadvisorProfessorStudentadvisorattributeProfessorstringProfessor4lProfessorProfessorattributelProfessorProfessorstringattributeStudentstringattributeattributeProfessorStudentadvisorattributeProfessorStudentProfessorProfessorStudentProfessor43286488BeginningC#Objects3.9lll3.10lllattributelllintdoubleboolStudentProfessorllAattributeB3.111SRSattributelClassroomlDepartmentlDegreeattributeC#22389BeginningC#Objects3B(PrescriptionTrackingSystem)4Color/90
本文标题:《Beginning-C#-Objects中文版-概念到代码》
链接地址:https://www.777doc.com/doc-4873349 .html