C# Module 4 Questions And Answers.
C# Module 4 Questions And Answers. Class - CORRECT ANSWER -Template -Defines structure for all objects that are going to be of that class type -When define a class, describe its attributes (fields) in terms of data and behaviors (methods) in terms of what kind of things it can do -By abstracting attributes and behaviors, can create a class to serve as a template from which many objects of the same type can be instantiated Access modifiers - CORRECT ANSWER -Classes: public, other classes can reuse class with different applications -Data members: private, only accessed within body of the class in which they are declared -Methods that access this data: public Fields - CORRECT ANSWER -"private data type nameOfField" -Represent the state of an object -Blueprint in terms of what kind of data will be associated with each object -Visible to all members of the class Constructors - CORRECT ANSWER -"public ClassName (declare variables) {variables = fields}" -Special types of methods used to create objects -Don't return a value, but don't include keyword void -Use same name as the class name -Overloaded: same identifiers but different signatures (number of arguments) -Public access: other classes can instantiate objects of this class -Provide values for data members: arguments to the constructor method (new variables assigned to value of fields) or hard coded into body
Escuela, estudio y materia
- Institución
- Harvard University
- Grado
- CS50
Información del documento
- Subido en
- 26 de mayo de 2024
- Número de páginas
- 3
- Escrito en
- 2023/2024
- Tipo
- Examen
- Contiene
- Preguntas y respuestas
Temas
-
cs50
-
c module 4 questions and answers
Documento también disponible en un lote