+ 4
Wrong quiz? An interface can implement another interface
A quiz says - true. Yet another wrong quiz answer? A screenshot: http://ibb.co/midcCv
40 Respuestas
+ 4
"interface members cannot have a definition": http://code.sololearn.com/c7HL54fvT3kO
+ 4
The sources state the same thing @Alx said, as well as the C# course itself.
Interfaces cannot implement anything.
+ 4
"Interfaces
When a class implements an interface, it must also implement, or define, all of its methods.
The term implementing an interface is used (opposed to the term "inheriting from") to describe the process of creating a class based on an interface.
The interface simply describes what a class should do.
The class implementing the interface must define how to accomplish the behaviors.
"
- C# course
+ 4
Well this evaded the reviewers how???
+ 3
I need to make a code using interfaces for it to be more clear.
It shows even if you complete a course you still need to code to learn.
+ 3
Funny, I believed SL staff checked quizzes. This could explain why sometimes I cannot believe an answer, especially when we both get it "wrong". Well I want to see how this can of worms that's been opened plays out.
+ 3
It is possible to implement an interface
https://code.sololearn.com/cMG119kbSUq9/?ref=app
+ 3
I thought is was wrong until,
after a challenge.
I mentioned it in the comments of this code.
https://code.sololearn.com/cFn7Cmk6r833/?ref=app
+ 3
Ok, I gad a look at that discussion and I am agree with Aibek T. in this:
"@Manual
Yeah.. I think I got what you meant..
When a class implements an interface it must actualy implement the missing functionalities of it's "abstract" methods...
but interfaces can contain only methods, properties.. methods without bodies (functinality implementation).
So from this point of view, I think you are right..
We can not tell that an interface IMPLEMENTS another interface...
I think we must say
"a class implements an interface"
but
"an interface INHERITS another interface"
"
+ 3
Anyway, if this question is so... kind of "not straight", controversion/contradixtion(al), then it shouldn't be in quizzes especially here at sololearn, where a lot of people memorize some answers (that they even don't understand that much). So it can cause confusion not only here but in future projects, actions, discussions...
+ 3
@Alx vSeti But I do agree with you.
Here's another argument for those who opposes the statement that interface can not implementninterface and it's right from the sololearn course itself:
"When a class implements an interface, it must also implement, or define, all of its methods.
The term implementing an interface is used (opposed to the term "inheriting from") to describe the process of creating a class based on an interface."
What else to say? In Java there is no such ambiguity/controversy because when some class impements interface we write
class Whatever implements SomeInterface {}
and when some interface inherits (from) other interface we write:
interface InTheMiddle extends FirstOrUpperInterface {}
+ 3
Wow, yeah. I even upvoted his comment but forgot already because:
first: it's issue is not solved for a very long time,
second: Manual changed his mind and now saying that the colon ":" there in interfaces inheritance means that interface is implementing another one interface!
+ 3
I'm going to play C# challenges just/right to report this question!!
+ 2
@Alx
I do not use interfaces much
I found this on stackexchange what do you think about these threads?
https://stackoverflow.com/questions/2283432/c-sharp-interfaces-only-implement-an-interface-in-other-interfaces
https://stackoverflow.com/questions/1688808/should-one-interface-inherit-another-interface
+ 2
@Jamie, write here when you report, please.
Or somebody else, who comes across this quiz sooner. And subsequent reporters - upvote that answer, please.
I would like to see how many minimum reporters does it take to correct a quiz.
+ 2
I guess there is confusion between inheritance and implementation. Therefore I submitted a quiz:
An interface can
✘ implement another interface
✔ inherit from another interface
✘ instantiate another interface
✔ be implemented by a struct
So vote it in the Quiz Factory, please. Or is it too complicated?
+ 2
@Alx
I will upvote it after I make a code using it.
edit
- done
It seems pretty useful, I am going learn how to use it for C++ as well!
+ 2
Yes, Andrew, and in such situation the qualification of quiz reviewers is questionable
+ 2
Reported that question a million times over
+ 2
And the main question now stays "what should we call implementation?" (can we call inheritance without implementation of virtual/abstract method an "implementation"?)