• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/18

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

18 Cards in this Set

  • Front
  • Back
What kinds of objects have signatures?
Methods, instance constructors (which is just a special kind of method), indexers, and operators.
What is the signature of an object?
The signature consists of the fully qualified name and the type, number and kind (value, ref, out) of the parameters. If there is no namespace conflict for the name of the object then only the local/short name need be used.
Is the return type of a method part of the signature?
No. The signature specically does not include the return type.
Is the 'params' modifier part of the signature of a method?
No. The 'params' modifier is not part of the signature.
What is the signature of an indexer?
The signature of an indexer is the type of each of its formal parameters. The signature does not include the element type.
What is the signature of an operator.
The signature of an operator consists of its name and the types of its formal parameters. It does not include its result type.
Why is the concept of a signature so powerful?
It allows classes, structs and interfaces to declare multiple versions of a method so long as their signatures are different.
Are the following member declarations in conflict:
void foo(int x);
void foo(out int x);
No. out and ref are also distinct components of a the signature.
Are the following declarations in conflict:
void foo(int x);
int foo(int x);
?
Yes. Output type is not a part of the signature.
Are the following declarations in conflict?
void foo(string[] a);
void foo(params string[] a);
Yes. The params modifier is not part of a signature.
What does the phrase "scope of an object" mean?
The scope of an object is the code segments from which that object can be referenced without qualification.
Can scopes be nested?
Yes. A member from an outer scope may be redeclared in an inner scope. Thus it masks the member with the same name from the outer scope.
Is this code legal?

int foo;
{
int foo;
}
No. Block nesting does not permit rescoping.
//Complete this code:
class foo
{
static int fooInt = 3;
class bar
{
int fooInt;
int i;

// reference the outer fooInt below
public bar()
{
i = ????;
}
}
}
foo.fooInt;
What is the scope of a member declared at the top level of a namespace?
The entire namespace.
Suppose there are two files in a project with top-level namespace declarations, "fooSpace". Are the objects within these two files mutually available?
Yes, objects declared within the same namespace receive their scoping from the namespace, not from the file.
Is the following sequence of statements legal?
public bar()
{
i = foo.fooInt;
{
int j = b;
const int b = 3;
}

}
No. The declaration of a constant must precede its use within a block. If the declaration of 'b' is before the reference then it will compile.
What is name hiding?
Name hiding results from two different possibilities. 1. nested scope and 2. inheritance.