Question
C# 1 .Who can access the protected section of a class? static methods Main child classes that class -and- child classes 2. In .NET, _________
C#
1 .Who can access the protected section of a class?
static methods
Main
child classes
that class -and- child classes
2. In .NET, _________ types are stored on the heap.
Integers
Reference
Structs
Value
3. How can you enable polymorphic behavior between related classes?
it has at least one property
it has at least one static function
it has at least one virtual function
it has at least one constructor
4. What is the value of result?
string name = "Steve"; |
int result = name.CompareTo("Steve"); |
5. What is the correct way to call the CreateCar method in other classes?
public static class CarFactory |
{ |
public static ICar CreateCar(string make, string model) |
{ |
return new Car(make, model); |
} |
} |
ICar yugo = CarFactory.CreateCar("Zastava Automobiles", "Yugo");
CarFactory factory = new CarFactory();
ICar yugo = factory.CreateCar("Zastava Automobiles", "Yugo");
CarFactory factory = new CarFactory();
ICar yugo = factory.CreateCar("Zastava Automobiles", "Yugo", 1980, ConsoleColor.Tan);
ICar yugo = CarFactory.CreateCar("Zastava Automobiles", "Yugo", 1980, ConsoleColor.Tan);
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started