Articles in the CSharp Category
Asp.Net, CSharp, Company asked interview questions, RSystems »
Q. Can I inherit two difference classes to partial classes? Following is the whole scenario of this question:
I have two classes XYZ and ABC and two partial classes of class myClass now is it possible:
partial class myClass : XYZ
{
}
partial class myClass : ABC
{
}
Ans: This question I have asked in RSystems, Noida and I am sharing hereunder with you :
We can’t inherit two difference classes to partial class because in C# multiple inheritance is not possible using classes.
The main reason is in C# we cant do the following:
class myClass : XYZ, …
CSharp, Microsoft .Net »
I have also asked a tricky question like this:
Can we create a singleton class using public constructor?
Simply answer is yes.
Practically, many of us aware that we can create a singleton class by using private constructor an creating a property, but we can create a singleton class by using public constructor as folows:
static void Main(string[] args)
{
try
{
Singleton obj3 = new Singleton2();
Singleton obj4 = new Singleton2();
Console.Read();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
Console.Read();
}
}
static void Main(string[] args)
{
try
{
Singleton obj3 = new Singleton2();
Singleton obj4 = new Singleton2();
Console.Read();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
Console.Read();
}
}
Tweet This Post
CSharp, OOPs, VB.Net Interview »
In overriding, you change the method behavior for a derived class.
While, overloading simply involves having a method with the same name within the class.
Tweet This Post
CSharp, OOPs, VB.Net Interview »
The method can be over-ridden.
Tweet This Post
CSharp, VB.Net Interview »
Yes ,but they are not accessible, out-side the class.
Tweet This Post
CSharp »
classes in the same namespace.
Tweet This Post
CSharp »
No, but we can use interfaces for that.
Tweet This Post
CSharp »
Place a colon(:)and then the name of the base class.
eg:
public baseclass
{
/ /signatures
}
public childclass : baseclass
{
//signature
}
Tweet This Post
CSharp, VB.Net Interview »
Thread.Abort ( ) stops the thread execution at that moment itself.
Tweet This Post
CSharp, VB.Net Interview »
Yes, we can use event with thread,this is one of the techniques to synchronize one thread with other.
Tweet This Post

