C# | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

C#

can one class inherit two classes in c#?

1st Apr 2018, 9:12 AM
robert kiprotich
robert kiprotich - avatar
9 Answers
+ 4
You can inherit from only 1 class, however you can implement multiple interfaces.
2nd Apr 2018, 8:28 AM
Rusty.Metal
+ 2
No, only one
1st Apr 2018, 9:15 AM
Chris
Chris - avatar
+ 2
You can implement multiple interfaces :)
1st Apr 2018, 9:22 AM
Chris
Chris - avatar
+ 1
I worked with Unity Engine a bit, but I don't have much knowedge. I've never implemented an interface in Unity, so if your question is related to that, I can't help you.
1st Apr 2018, 9:26 AM
Chris
Chris - avatar
+ 1
Danila ary crazy(nope).
4th Mar 2020, 2:54 AM
Nikita
0
what about using interfaces?
1st Apr 2018, 9:21 AM
robert kiprotich
robert kiprotich - avatar
0
@chris do you have some knowledge in unity game engie?
1st Apr 2018, 9:24 AM
robert kiprotich
robert kiprotich - avatar
0
im trying to rise terrains but it cant it only lowers..
1st Apr 2018, 9:39 AM
robert kiprotich
robert kiprotich - avatar
0
No,It's not possible(c# does not support multiple inheritance using classes). Although you can implement two or more interface in a single class or you can inherit one class and implement multiple interface in a class but can't inherit more than one class.
2nd Jan 2021, 4:18 PM
Pavan Barve
Pavan Barve - avatar