Final Flashcards

1
Q

encapsulation

A

classes and objects can hide information from the outside world

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

Polymorphism

A

The fact that child classes can override the methods and attributes of the super class

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

inheritance

A
any class may inherit    
    members from another class.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

class modifiers

A

internal (or none)–Class accessible only from within the current project
public–Class accessible from anywhere.
abstract–accessible only from within the current project, and cannot be instantiated, only derived from.
public abstract–Class accessible from anywhere, and cannot be instantiated, only derived from.
sealed–cannot be derived from, only instantiated.

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

new

A

Applies To Function members

The member hides an inherited member with the same signature.

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

static

A

The member does not operate on a specific instance of the class

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

virtual

A

Classes and function members only

–The member can be overridden by a derived class.

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

abstract

A

Function members only–A virtual member that defines the signature of the member, but does not provide an implementation

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

override

A

Function members only–The member overrides an inherited virtual or abstract member.

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

sealed

A

Classes, methods, and properties–For classes, the class cannot be inherited from. For properties and methods, the member overrides an inherited virtual member, but cannot be overridden by any members in any derived classes. Must be used in conjunction with override.

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

extern

A

Static methods only–The member is implemented externally, in a different language.

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

properties

A

Sets of functions that can be accessed from the client as a

field. Improves data integrity.

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

Methods

A

Functions associated with a class. Can be static (tied to the
class) or instance (tied to the object).

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

Constructors

A

Special functions that run automatically when an object

is created. Good for initializing the values of fields

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

collections

A

Collections are similar to arrays in that they hold groups of objects.
Collections differ from arrays in that they provide advanced functionality such as:
Ability to grow once they are created
Controlled access to objects
Provide functions to search and sort
Ability to provide strongly typed collections
Ability to expose specialized methods

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

ArrayList

A

increase and decrease the number of elements dynamically

can hold a collection of similar objects.

17
Q

ArrayList syntax

A

using System.Collections;
ArrayList animalArrayList = new ArrayList();
Cow myCow = new Cow(“Bossie”);
animalArrayList.Add(myCow);
animalArrayList.Add(new Chicken(“Cluck”));

18
Q

delegate

A

an object that points to another

method (or list of methods) in the application.

19
Q

delegate syntax

A
public delegate int MathOp(int x, int y);
public class SimpleMath
{
  public static int Add(int x, int y)
   { return x + y; }
  public static int Sub(int x, int y)
   { return x – y; }
}
class Program
{
  Static void Main()
  {
    MathOp myOp = new MathOp(SmpleMath.Add);
    MathOp myOp2 = new MathOp(SimpleMath.Sub);
    Console.WriteLine(“10 + 10 is {0}”, myOp(10,10));
    Console.WriteLine(“10 – 5 is {0}”, myOp2(10,5));
  }
}
20
Q

Enumerations

A

a convenient way to
create a set of symbolic names that map to known
numeric values.

21
Q

Enumerations syntax

A
enum EmployeeType
	 {
	  Manager = 50,  
 	  Clerk = 10, 
 	  President = 100,    
 	  Customer = 6
 	 }
22
Q

StreamReader

A
string line;
	using (StreamReader reader = new StreamReader("file.txt"))
	{
	    line = reader.ReadLine();
	}
	Console.WriteLine(line);
    }