Interview Tips

1. What is static keyword in .Net?

Static is same as constant variable(Assign the values at compile time only)  but we can change the value of static variable and we can access the variables without creating any instances.

2. What is Interface and their use?

Interface looks like a class, but has no implementation. The only thing it contains are declarations of events,Methods and proprieties.

Inheritance allows creating classes that are derived from other classes, so that they automatically include some of its “parent’s” members, and also its own.

Eg

Declaration 

interface Father

{

}

Implementation

class Children: Father

{

}

3. Polymorphism

In Polymorphism poly means “multiple” and morph means “forms” so polymorphism means many forms.

Polymorphism has ability to provide different implementation of methods that are implemented with same name.

Two types

Compile Time : Also called as Early Binding or Overloading or static binding

Run Time :Also called as Late Binding or Overriding or dynamic binding

Eg:

public class Class1

{

public void NumbersAdd(int a, int b)

{

Console.WriteLine(a + b);

}

public void NumbersAdd(int a, int b, int c)

{

Console.WriteLine(a + b + c);

}

}

 

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s