❔ interface

Always get error with double inheritance help please
35 Replies
hercules_x_x
hercules_x_x2y ago
ero
ero2y ago
look at what the error says?
hercules_x_x
hercules_x_x2y ago
'Circle' does not implement interface member 'IShape_C.circumference()' [hw6]csharp(CS0535) why it cant
ero
ero2y ago
because it doesn't there is no circumference method in Circle
hercules_x_x
hercules_x_x2y ago
how to make it dose circumference?
ero
ero2y ago
add a method called circumference to Circle
hercules_x_x
hercules_x_x2y ago
but it must be done with constuctor that the teacher request
ero
ero2y ago
you already have a constructor that one is fine
hercules_x_x
hercules_x_x2y ago
ok ok guid me so i will add method
ero
ero2y ago
you need a method called circumference in Circle
hercules_x_x
hercules_x_x2y ago
ok ok wait
hercules_x_x
hercules_x_x2y ago
already
ero
ero2y ago
already what?
hercules_x_x
hercules_x_x2y ago
ohhhhh
ero
ero2y ago
i don't see a method called circumference
hercules_x_x
hercules_x_x2y ago
i see isee wrong type lol
hercules_x_x
hercules_x_x2y ago
work amazing
hercules_x_x
hercules_x_x2y ago
thanks a lot ❤️
ero
ero2y ago
👍
hercules_x_x
hercules_x_x2y ago
btw any idea why cant use double inheritance with abstract got me confused
ero
ero2y ago
what do you mean?
hercules_x_x
hercules_x_x2y ago
or maybe can lol so there is abstract and interface
ero
ero2y ago
mhm
hercules_x_x
hercules_x_x2y ago
in abstract cant use double inheritance can i know why
MODiX
MODiX2y ago
Ero#1111
REPL Result: Success
interface I1 { }
interface I2 { }
abstract class C : I1, I2 { }
interface I1 { }
interface I2 { }
abstract class C : I1, I2 { }
Compile: 379.450ms | Execution: 30.491ms | React with ❌ to remove this embed.
ero
ero2y ago
you can
hercules_x_x
hercules_x_x2y ago
but for class I1 and I2 u still using interface
ero
ero2y ago
oh, yeah you can't inherit from 2 classes at once
hercules_x_x
hercules_x_x2y ago
abstract I1 { } abstract I2 { } abstract class C : I1, I2 { } can be like that
ero
ero2y ago
only 1 class and/or multiple interfaces
hercules_x_x
hercules_x_x2y ago
may i know why or no reason just like that
ero
ero2y ago
there's good reasons for that but i don't know enough to explain it well
hercules_x_x
hercules_x_x2y ago
ahh ok ok advance here i come lol thanks a lot for everything 🙏
bookuha
bookuha2y ago
Multiple inheritance caused many problem in the past So it was decided to move on interfaces and eliminate multiple inheritance in c# You have to always remember if there is no conflict caused by having similar member in your parent classes
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.