Lesson 2 Flashcards

1
Q

objects

A

self-contained data structures that consist of properties, methods, and events. Properties specify the data represented by an object (adjective), methods specify an object’s behavior (actions or verbs), and events provide communication between objects.

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

encapsulation

A

Hiding the complexity of code inside something.

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

class (context of object oriented programming)

A

a class is like the template from which individual objects are created.

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

another name for object:

A

instance of a class

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

method

A

code blocks containing a series of statements

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

constructors

A

used to initialize the data members of the object.

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

How are objects created?

A

From the templates defined by classes.

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

What is the use of properties?

A

Allow you to access class data in a safe and flexible way.

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

access modifier

A

specifies what region of the code will have access to a field.

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

method’s signature

A

a method’s name, its parameter list, and the order of data types of the parameters. A method’s signature must be unique within a class.

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

default constructor

A

a constructor that takes no arguments

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

What is the method line format?

A

access level - return type - method name - parameters in parentheses - followed by a block of code in curly braces.

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

What are properties?

A

class members that can be accessed like data fields, but contain code like a method.

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

types of accessors:

A

get - used to return the property value.

set - used to assign a new value to the property.

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

When defining properties, a missing set accessor causes what?

A

You don’t provide a way to set the value of the property, and it becomes read-only as a result.

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

When defining properties, a missing get accessor causes what?

A

You don’t provide a way to get the value of the property, and it becomes write-only as a result.

17
Q

auto-implemented properties

A

simplify property declarations

18
Q

“this” keyword use

A

accesses members from within constructors, instance methods, and accessors of instance properties.

19
Q

delegates

A

special types that are used to encapsulate a method with a specific signature. They’re like an agreement or a contract between a publisher and a subscriber. It determines the signature of the event handler method in the subscriber.

20
Q

events

A

a way for a class to notify other classes or objects when something of interest happens.

21
Q

publisher

A

the class which sends the notification to the subscriber during an event.

22
Q

subscriber

A

the class which receives the notification from the publisher during an event.

23
Q

two pieces of information needed when defining events:

A

a delegate that connects the event with its handler method(s), and a class that contains the event data. (Usually derived from the EventArgs class)

24
Q

What is the purpose of a namespace?

A

It allows you to organize code and create unique class names.

25
Q

static members

A

belong to a class itself rather than individual objects.

26
Q

What does a value type do?

A

It directly stores a value.

27
Q

What does a reference type do?

A

It stores only a reference to a memory location, not the value itself.

28
Q

What is the keyword “struct” used for?

A

To create a user-defined data types that consist of small groups of related fields. Structs are value types - as opposed to classes, which are reference types. They cannot inherit from another class or struct.

29
Q

access modifiers

A

control where a type or type member can be used.

30
Q

assembly

A

a unit of executable code that can be independently versioned and installed.

31
Q

base class

A

the class whose functionality is inherited.

32
Q

derived class

A

The class that inherits the functionality from a base class

33
Q

abstract classes

A

provide a common definition of a base class that can be shared by multiple derived classes.

34
Q

sealed classes

A

provide complete functionality but cannot be used as base classes.

35
Q

polymorphism

A

the ability of derived classes to share common functionality with base classes but still define their own unique behavior.

36
Q

keyword “virtual” use

A

allows for the derived classes to override the method.

37
Q

keyword “override” use

A

replaces a base class member in a derived class

38
Q

keyword “new” use

A

creates a new member of the same name in the derived class and hides the base class implementation

39
Q

interface use

A

to establish contracts through which objects can interact with each other without knowing the implementation details.