By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,965 Members | 1,505 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,965 IT Pros & Developers. It's quick & easy.

Inheriting class with private constructor

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.