I have this problem in my university I need use interface and abstract class.
I have a class person with this fields> name, datebirth, country, number of soons, name of wife.

Plus I need make security question fox example:
The first form ask me about the name of the person , in the next form show me 3 different security question and 5 answers the answers can be country, datebirth, etc.
So I going to have question class abstract, other class for answer. So the program nee be prepare to ad anything class and answer.

1 solution

Solution 1

Clearly what you need to do here is study and learn what interfaces and abstract classes "are," and what they are designed for, and how they are best used, in C#, and .NET.

Here on CodeProject you can find several articles/tutorials directly comparing the use of Interfaces with Abstract Classes: I suggest you start here: [^].

And, there are many excellent tutorials on the web, and on MSDN. Just Google !

No one here is going to do your homework for you. What you present here is too vague, and confused, to start an "answer" to this not-a-question. You kind of imply some kind of "wizard-like" ui that moves from one screen to another, you kind of imply this is some kind of elaborate security clearance system, but it's all too fuzzy to really visualize, at least for me.

You need to get clear in your mind: what, in the solution your project implements, requires that you use an abstract class; what requires you use an interface. If it's the case that you could use either an abstract class, or, interface: then you should be able to understand which one is a better choice in the context of your project.

Then you need to prototype some code, and do an initial implementation. Then, you can post questions here, giving specific examples from your code, and asking specific questions; and those specific questions can, and will be, I am sure, generously responded to by the many technically excellent minds that help-out, here, on QA.