Terminology Flashcards
what is a class?
A class is like a blueprint of a specific object. A class enables you to create your custom types by grouping variables of other types, methods, and events.
What is the difference between a class and an object?
In c#, Classes and Objects are interrelated. The class in c# is nothing but a collection of various data members (fields, properties, etc.) and member functions. The object in c# is an instance of a class to access the defined properties and methods.
What are namespaces in c# .NET?
Namespaces are used in C# to organize and provide a level of separation of codes. They can be considered as a container which consists of other namespaces, classes, etc.
what is a boolean and what is it’s default value?
Boolean value= True or False default: False
what is a byte and what is it’s range and default value?
8-bit unsigned integer from 0 to 255 default=0
name 3 variable types that require a letter also-
decimal =m double = d float = f
what is type conversion and what are it’s 2 forms?
Type conversion is converting one type of data to another type. It is also known as Type Casting. In C#, type casting has two forms − Implicit type conversion − These conversions are performed by C# in a type-safe manner. For example, are conversions from smaller to larger integral types and conversions from derived classes to base classes. Explicit type conversion − These conversions are done explicitly by users using the pre-defined functions. Explicit conversions require a cast operator. example: ———————————————- Using System; namespace TypeConversionApplication { class StringConversion { static void Main(string[] args) { int i = 75; float f = 53.005f; double d = 2345.7652; bool b = true; Console.WriteLine(i.ToString()); Console.WriteLine(f.ToString()); Console.WriteLine(d.ToString()); Console.WriteLine(b.ToString()); Console.ReadKey(); } } }
what is a variable?
A variable is nothing but a name given to a storage area that our programs can manipulate. Each variable in C# has a specific type, which determines the size and layout of the variable’s memory the range of values that can be stored within that memory and the set of operations that can be applied to the variable.
What is an interface?
basically like a contract-it tells a class what must be in it.
what are the 4 things an interface can define?
- methods 2. properties 3. indexes 4.events
what forces a class to implement any of 4 pieces of information?
interfaces
are interfaces public or private?
interfaces are ALWAYS public
what is the naming convention for Interfaces
always start with capital “I” then the name such as “IMyInterface”
what is the default access modifier for Interfaces?
public- Interfaces must be public therefore if no access modifier is given the default is public
if you define a method within an Interface- what should the access modifier be?
you can drop the access modifier because Interfaces are always public
how do you define a method within Interfaces?
with only the method signature: void LogMessage(string message); normal declaration: public void LogMessage(string message) { Console.WriteLine(“your message”); }
what is dependency injection and what is it’s intent?
Dependency Injection (DI) is a software design pattern. It allows us to develop loosely-coupled code. The intent of Dependency Injection is to make code maintainable. Dependency Injection helps to reduce the tight coupling among software components. Dependency Injection reduces the hard-coded dependencies among your classes by injecting those dependencies at run time instead of design time technically.
what is a constructor?
A constructor is a special method of the class which gets automatically invoked whenever an instance of the class is created. Like methods, a constructor also contains the collection of instructions that are executed at the time of Object creation.

name 7 important things to remember about constructors-
- Constructor of a class must have the same name as the class name in which it resides.
- A constructor can not be abstract, final, static and Synchronized.
- Within a class, you can create only one static constructor.
- A constructor doesn’t have any return type, not even void.
- A static constructor cannot be a parameterized constructor.
- A class can have any number of constructors.
- Access modifiers can be used in constructor declaration to control its access i.e which other class can call the constructor.
what is a constructor?
a method that is called with an instance of a class is created
why do we need a constructor?
the intention is to put an object in a early state
-that is to initialize some of the fields in the class
what is constructor overloading?
having a method by the same name but different signatures

what is a method signature?
a dignature is what uniquely identifies a method
that is:
its name
its return type
and the types and number of its perameters

What is an object initializer?
a syntax for quickly initializing an object without the need to call one of its constructors
why do we need object initializers?
to avoid creating multiple constructors

what is the syntax for an object initializer?
see image

what does it mean to overload a method?
having a method with the same name but different signatures
-see image

how does one use the Params modifier and why?
when there are too many possible constructors the code -see image
one could use an array but then the array must be initialized before each use
instead use a Params Modifier

What is an access modifier?
An access modifier is a way to control access to a control and/or its members (such as public or private)
what is a property?
a property is a class member that encapsulates a getter/setter for accessing a field
A property is a member that provides a flexible mechanism to read, write, or compute the value of a private field. Properties can be used as if they are public data members, but they are actually special methods called accessors.
what is an Indexer?
Indexer is a special kind of property that allows accessing elements of a list by an index. - If a class has the semantics of a list, or collection, we can define an indexer property for it. This way it’s easier to get or set items in the collection.
-see image (cookie [“name”]= “mosh”;
is indexer

What is class coupling?
Class coupling is a measure of the dependencies a class has on other classes. This dependency is measured through parameters, method calls and interface implementations, just to name a few. The higher this number, the more likely a change in one class will affect other classes.
what’s the problems with Inheritance?
see attached

Name the 5 access modifiers
see attached
