Liner Interview
Liner Interview
Class
A class is a blueprint of an object that contains variables for storing data and functions
to perform operations on the data.
Object
Objects are the basic run-time entities of an object-oriented system. They may
represent a person, a place or any item that the program must handle.
Abstraction
Abstraction is the process of hiding the working style of an object and showing the
information of an object in an understandable manner.
Abstraction is "To represent the essential feature without representing the background
details."
Encapsulation
Encapsulation means hiding the internal details of an object, in other words how an
object does something.
Wrapping up a data member and a method together into a single unit (in other words
class) is called Encapsulation.
https://www.tutlane.com/tutorial/csharp/csharp-encapsulation
Inheritance
Inheritance is a process of object reusability.
Polymorphism
Polymorphism provides the ability to a class to have multiple
implementations with the same name.
Abstraction Encapsulation
1. Abstraction solves the problem at the 1. Encapsulation solves the problem in the
design level. implementation level.
2. Abstraction hides unwanted data and 2. Encapsulation means hiding the code and data into a
provides relevant data. single unit to protect the data from the outside world.
3. Abstraction lets you focus on what the 3. Encapsulation means hiding the internal details or
object does instead of how it does it mechanics of how an object does something.
Generics
Generics allow you to define type-safe classes without compromising type safety, performance
or productivity. Generic introduce to the .NET Framework the concept of type parameter, which
make it possible to design classes and methods.
Namespace
In c#, Namespace is used to organize the multiple classes in our applications and it will reduce the
code redundancy in our .NET applications. By using the namespace keyword, we can define the
namespaces in our c# applications.
O- Open/Closed Principle
Benefit of solid
Simplifies debugging
Simplifies maintenance
A class should take one responsibility and there should be one reason to change that class.
This class should be open for extension but closed for modification. But how to do that!!
Child class should not break parent class’s type definition and behavior.
4. Interface segregation principle (ISP)
This principle states that any client should not be forced to use an interface which is
irrelevant to it.
5. Dependency inversion principle (DIP)
This principle tells you not to write any tightly coupled code because that is a
nightmare to maintain when the application is growing bigger and bigger. If a class
depends on another class, then we need to change one class if something changes in
that dependent class. We should always try to write loosely coupled class.
Design Patterns In C#
Design patterns provide general solutions or a flexible way to solve common design
problems.
This pattern ensures that the class has only one instance and provides a global point
of access to it. The pattern ensures that only one object of a specific class is ever
created.
Ref
The ref keyword is used to pass an argument as a reference. This means that when value
of that parameter is changed in the method, it gets reflected in the calling method. An
argument that is passed using a ref keyword must be initialized in the calling method
before it is passed to the called method.
Out
The out keyword is also used to pass an argument like ref keyword, but the argument
can be passed without assigning any value to it. An argument that is passed using an
out keyword must be initialized in the called method before it returns back to calling
method.
1. What is Multithreading in C#?
Multithreading allows you to perform concurrent processing so that you can do more
than one operation at a time. The .NET Framework System. Threading namespace is
used to perform threading in C#.
1. What is Constructor?
A constructor is a special type of function/method which has the same name as its class.
The constructor is invoked whenever an object of a class is created. It is called
constructor since it constructs the values of the class data members.