Click here to Skip to main content
15,915,093 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a class OrderItemcl. and it has not any default constructor.
When i inherit this class in TestOrderItemcl it gives error msg.

OrderItem does not contain any constructor that takes 0 argument.
Posted
Comments
k@ran 27-Aug-12 1:16am    
how to solve this issue ?

Add the following to your OrderItem class :
C#
public class OrderItem
{
   public OrderItem() //add this
   {
   }

   // rest of your code
}
 
Share this answer
 
Comments
k@ran 27-Aug-12 1:39am    
can i do it without modifying OrderItemcl class
Mehdi Gholam 27-Aug-12 1:44am    
Change the code where you are using it (change the lines where you are getting the error in Visual Studio).
use a constructor on the child class that calls base (parent) constructor as :

C#
public child(int i) : base(i)

Make sure you use appropriate types, I used int i here.

Thanks,

Kuthuparakkal
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900