469,942 Members | 2,545 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,942 developers. It's quick & easy.

Inheriting class with private constructor

Does anybody know how to inherit from a class with a private constructor? I
am trying to inherit from DataRow as follows:

public class MyDataRow : DataRow
{
private MyDataRow()
{
}
}

When I compile this, I get "No overload for method 'DataRow' takes '0'
arguments"

Any ideas?

Thank you,
Michael Carr
Nov 18 '05 #1
1 1979
Hi,
Getting “Could not find any resources “error while using some resource
files to make the internationalization of a ASP.NET application

1) You get that error because DataRow constructor demand parameter that
you didn’t supply :

private MyDataRow(System.Data.DataRowBuilder builder):base(builder)
{
}

2) You can’t inherit from class with private constructor. if you want
your class to be accessible only for inherit class mark your constructor
as protected.

public class MyDataRow : System.Data.DataRow
{

protected MyDataRow(System.Data.DataRowBuilder builder):base(builder)
{
}
}
public class aa : MyDataRow
{
public aa(System.Data.DataRowBuilder builder):base(builder)
{

}
}

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Andy Jarrell | last post: by
13 posts views Thread by Bryan Parkoff | last post: by
4 posts views Thread by Thomas Matthews | last post: by
11 posts views Thread by Noah Coad [MVP .NET/C#] | last post: by
2 posts views Thread by Jim Heavey | last post: by
4 posts views Thread by AalaarDB | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.