csharp Flashcards

1
Q

What is a struct used for?

A

structs are basically classes that have defined values, properties, methods, maybe minor business logic

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

virtual keyword?

A

you need to define a method virtual if you want to potentially override it later
public virtual int ()[ }

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Automatic properties

A

Automatic properties are properties that automatically have getters/setters

public string Name { get; set; }

Class1 c1 = new Class1();
# This knows that you want it to use the getter method
Console.WriteLine(c1.Name);
# this one knows you want to use the set method
c1.Name = "derek";
Console.WriteLine(c1.Name);
Program program = new Program();
program.two();
How well did you know this?
1
Not at all
2
3
4
5
Perfectly