Podcast
Questions and Answers
What is the purpose of a constructor in a class?
What is the purpose of a constructor in a class?
What happens if you do not create a class constructor yourself?
What happens if you do not create a class constructor yourself?
What is the purpose of constructor parameters?
What is the purpose of constructor parameters?
What is the name of the constructor in the following code: class Car { ... }
?
What is the name of the constructor in the following code: class Car { ... }
?
Signup and view all the answers
How many parameters can a constructor have?
How many parameters can a constructor have?
Signup and view all the answers
What is the output of the following code: Car Ford = new Car ( "Mustang", "Red", 1969); Console.WriteLine( Ford.color + " " + Ford.year + " " + Ford.model);
?
What is the output of the following code: Car Ford = new Car ( "Mustang", "Red", 1969); Console.WriteLine( Ford.color + " " + Ford.year + " " + Ford.model);
?
Signup and view all the answers
What is the purpose of a constructor in a class?
What is the purpose of a constructor in a class?
Signup and view all the answers
How do you access a method in a class?
How do you access a method in a class?
Signup and view all the answers
What is the difference between a static method and a public method?
What is the difference between a static method and a public method?
Signup and view all the answers
What is the purpose of a field in a class?
What is the purpose of a field in a class?
Signup and view all the answers
Why did we declare the fullThrottle
method as public and not static?
Why did we declare the fullThrottle
method as public and not static?
Signup and view all the answers
What is the syntax to call a method in a class?
What is the syntax to call a method in a class?
Signup and view all the answers
What is the purpose of a constructor in a class?
What is the purpose of a constructor in a class?
Signup and view all the answers
What is the advantage of using a constructor in the example given?
What is the advantage of using a constructor in the example given?
Signup and view all the answers
What is the access modifier that allows access to a class from any other class?
What is the access modifier that allows access to a class from any other class?
Signup and view all the answers
What is created when you use the new keyword in C#?
What is created when you use the new keyword in C#?
Signup and view all the answers
Which of the following access modifiers allows access to a class only within the same class?
Which of the following access modifiers allows access to a class only within the same class?
Signup and view all the answers
What is the purpose of overloading a constructor in C#?
What is the purpose of overloading a constructor in C#?
Signup and view all the answers