System.Activator class problem

  • Thread starter Thread starter Sabarinath
  • Start date Start date
S

Sabarinath

Hi,

Why it is not possible to create an instance for System.Activator class. It
is saying that "member is inaccessible due to its protection level", in
compilation. Acutally it is a public sealed class. It is possible to create
an instance of my own public sealed class.

Can anybody explain me Why?

Thanks in advance.

Regards
Sabari.
 
Hi,

My sealed class doesn't have any default constructor.
The below is my class:

using System;

namespace TestLib
{
/// <summary>
/// Summary description for SealedClass.
/// </summary>
public sealed class SealedClass
{
public static string Display()
{
string s = "hai";
return s;
}
}
}

Thanks.

Regards,
Sabari.
 
Sabarinath said:
My sealed class doesn't have any default constructor.

Yes it does. Unless you specify any constructors at all, you get a
public parameterless one.

However, that doesn't sound like the problem - the problem is that
Activator *doesn't* have a public constructor - you're not meant to
instantiate it. Why are you trying to?
 
Back
Top