Class Library has 'No constructors defined error'
-
Friday, September 21, 2012 11:52 PM
This is my first time writing a class library for a proof of concept Spelling Test Program. It takes a list of words, says it, and waits for user response. Then, it returns the grade.
That is the class library's job. I just finished the library, and compiled it.
Error 1 The type 'Spelling_Test_Core.Quiz' has no constructors defined
I know there is a constructor defined right here:
public class Quiz { private string[] Words; int PTS = 0; Quiz(string[] words, int pts) //Constructor { Grade gr = new Grade(); gr.Cleanup(); Words = words; PTS = pts; }
This is the declaration of a member:
string[] Programs = new string[2]; Programs[0] = "Pears!"; Programs[1] = "Carrots!"; // Quiz qu = new Quiz(Programs , 10); Quiz qu = new Quiz();
The commented out one is the correct constructor with arguments that returns a similar error.
All Replies
-
Saturday, September 22, 2012 12:12 AM
Change the following line:Quiz(string [] words, int pts)to the following:public Quiz(string [] words, int pts)You did not declare it public, so externally, there were no constructors visible.
--
Mike- Proposed As Answer by Mitja BoncaMicrosoft Community Contributor Saturday, September 22, 2012 6:16 AM
- Marked As Answer by Chester HongMicrosoft Contingent Staff, Moderator Tuesday, October 02, 2012 8:45 AM


