Click here to Skip to main content
15,867,704 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# 2008 dynamic path Pin
PIEBALDconsult1-Sep-12 7:26
mvePIEBALDconsult1-Sep-12 7:26 
GeneralRe: C# 2008 dynamic path Pin
Mycroft Holmes1-Sep-12 13:43
professionalMycroft Holmes1-Sep-12 13:43 
QuestionSelect next control if control is in groupbox? Pin
GrooverFromHolland1-Sep-12 0:47
GrooverFromHolland1-Sep-12 0:47 
AnswerRe: Select next control if control is in groupbox? Pin
OriginalGriff1-Sep-12 1:47
mveOriginalGriff1-Sep-12 1:47 
GeneralRe: Select next control if control is in groupbox? Pin
GrooverFromHolland1-Sep-12 5:35
GrooverFromHolland1-Sep-12 5:35 
AnswerRe: Select next control if control is in groupbox? Pin
Eddy Vluggen1-Sep-12 3:36
professionalEddy Vluggen1-Sep-12 3:36 
AnswerRe: Select next control if control is in groupbox? Pin
BillWoodruff3-Sep-12 15:38
professionalBillWoodruff3-Sep-12 15:38 
QuestionExperimentation - Would Like Feedback Pin
Matt U.31-Aug-12 9:59
Matt U.31-Aug-12 9:59 
In the past, I had honestly never really been too great with inheritance and such. I've used interfaces before but never "properly" I guess you would say. So today, in order to grasp the concept a little more, I decided to experiment with it a bit. I created a Class Library with components I can use to create the structure of a "quiz." The project is simply called "QuizLib." Now, the functionality works just as I had planned. But I would like to know if I went about it the correct way:

Interfaces

IQuiz - Quiz interface; contains information about the quiz (title, subtitle, etc.)
    * string Title; - The title of the quiz
    * string SubTitle; - The subtitle of the quiz
    * List<iquestion> Questions; - A collection of questions which are part of the quiz

    * void AddQuestion(IQuestion question);
    * void RemoveQuestion(IQuestion question);

IQuestion - Question interface; contains information about questions which are part of the quiz (IQuiz)
    * string QuestionText; - The text for the question (e.g. Is CodeProject.com the best?!)
    * int Points; - The amount of points the question is worth

IAnswer - Answer interface; contains information about an individual answer for an IQuestion
    * string AnswerText; - The answer's text (what will be displayed when you render the question with answers - e.g. "Yes", e.g. "No")
    * bool IsCorrect; - Is the answer a correct answer (this is only used in Multiple Choice questions and True/False questions)


And then I have 2 classes which implement the IQuestion interface. And I have 2 classes which implement the IAnswer interface.

class MultipleChoiceQuestion : IQuestion ...... class TrueFalseQuestion : IQuestion

class MultipleChoiceAnswer : IAnswer ...... class TrueFalseAnswer : IAnswer

For MultipleChoiceQuestion, there is no limit on how many answers the question can have. The MultipleChoiceQuestion class adds a "HasOneAnswer" field, which determines whether or not only ONE answer can be correct, or if the user must select more than one in order to correctly answer the question. For TrueFalseQuestion, the List<ianswer> field is auto-generated by the class, since "True" and "False" are the only 2 options.

I hope this makes sense to everyone. Haha. I'm just trying to find out if I'm getting the concept fairly well. Or what I may need to do in order to improve in this topic.

Again, it works as expected. I can easily extend the code to support various question and answer types. That seems to be the basic concept. But still, I wanted to ask. Smile | :)
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.

AnswerRe: Experimentation - Would Like Feedback Pin
SledgeHammer0131-Aug-12 10:52
SledgeHammer0131-Aug-12 10:52 
AnswerRe: Experimentation - Would Like Feedback Pin
ekolis31-Aug-12 11:26
ekolis31-Aug-12 11:26 
AnswerRe: Experimentation - Would Like Feedback Pin
Ravi Bhavnani31-Aug-12 12:36
professionalRavi Bhavnani31-Aug-12 12:36 
AnswerRe: Experimentation - Would Like Feedback Pin
OriginalGriff1-Sep-12 1:53
mveOriginalGriff1-Sep-12 1:53 
GeneralRe: Experimentation - Would Like Feedback Pin
Matt U.6-Sep-12 7:29
Matt U.6-Sep-12 7:29 
GeneralRe: Experimentation - Would Like Feedback Pin
OriginalGriff6-Sep-12 7:58
mveOriginalGriff6-Sep-12 7:58 
Questionpassing data between forms Pin
mamoony31-Aug-12 8:53
mamoony31-Aug-12 8:53 
AnswerRe: passing data between forms Pin
Richard Andrew x6431-Aug-12 9:18
professionalRichard Andrew x6431-Aug-12 9:18 
AnswerRe: passing data between forms Pin
OriginalGriff31-Aug-12 9:21
mveOriginalGriff31-Aug-12 9:21 
GeneralRe: passing data between forms Pin
mamoony31-Aug-12 10:08
mamoony31-Aug-12 10:08 
GeneralRe: passing data between forms Pin
OriginalGriff31-Aug-12 21:09
mveOriginalGriff31-Aug-12 21:09 
GeneralRe: passing data between forms Pin
BillWoodruff3-Sep-12 15:59
professionalBillWoodruff3-Sep-12 15:59 
GeneralRe: passing data between forms Pin
mamoony10-Sep-12 10:06
mamoony10-Sep-12 10:06 
QuestionDelete From XML File Pin
Kevin Marois31-Aug-12 8:47
professionalKevin Marois31-Aug-12 8:47 
AnswerRe: Delete From XML File Pin
PIEBALDconsult31-Aug-12 9:40
mvePIEBALDconsult31-Aug-12 9:40 
GeneralRe: Delete From XML File Pin
Kevin Marois31-Aug-12 9:52
professionalKevin Marois31-Aug-12 9:52 
GeneralRe: Delete From XML File Pin
PIEBALDconsult31-Aug-12 11:20
mvePIEBALDconsult31-Aug-12 11:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.