Does inheritance include extending and implementing? Conceptual understanding [duplicate]

Multi tool use
This question already has an answer here:
What is the difference between inherits and implements in C#
5 answers
I'm just trying to understand this a bit. Does Inheritance mean you've extended a class (or abstract class) but can also mean you've just implemented an interface? Other questions are about their actual usage and I'm looking for a conceptually understanding
c# oop
marked as duplicate by Rufus L
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 28 '18 at 21:42
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
|
show 2 more comments
This question already has an answer here:
What is the difference between inherits and implements in C#
5 answers
I'm just trying to understand this a bit. Does Inheritance mean you've extended a class (or abstract class) but can also mean you've just implemented an interface? Other questions are about their actual usage and I'm looking for a conceptually understanding
c# oop
marked as duplicate by Rufus L
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 28 '18 at 21:42
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
2
If you are strict, inheritance does not include implementing an interface. Because a class implements (as you already noted yourself) an interface, it does not inherit from it. Now, humans sometimes are not very strict in their uses of words, and sometimes they use words in a fuzzy, ambiguous and sometimes even somewhat incorrect manner. (Fun fact: Interfaces can extend interfaces, so there is that to consider, too)
– elgonzo
Dec 28 '18 at 21:28
1
You inherit from base classes and implement interfaces. You can inherit from a base class without also extending it, though that's rather pointless to do so.
– Amy
Dec 28 '18 at 21:28
Oh, and by the way, there is a proposal for the next C# version (C# 8) about the support for default interface methods, which -- if that proposal would make it into C# 8 -- makes the distinction between interfaces and abstract classes a little less clear-cut (for a lack of a better term).
– elgonzo
Dec 28 '18 at 21:34
@elgonzo: They got that idea from Java; it's a terrible idea unless perhaps their intention is to bring back multiple inheritance in some form.
– Robert Harvey♦
Dec 28 '18 at 21:36
In any case, extension is the more general term for what happens when you implement an interface or inherit from a base class. It can also refer to something you put in your browser. Java uses theextends
keyword to indicate inheritance.
– Robert Harvey♦
Dec 28 '18 at 21:39
|
show 2 more comments
This question already has an answer here:
What is the difference between inherits and implements in C#
5 answers
I'm just trying to understand this a bit. Does Inheritance mean you've extended a class (or abstract class) but can also mean you've just implemented an interface? Other questions are about their actual usage and I'm looking for a conceptually understanding
c# oop
This question already has an answer here:
What is the difference between inherits and implements in C#
5 answers
I'm just trying to understand this a bit. Does Inheritance mean you've extended a class (or abstract class) but can also mean you've just implemented an interface? Other questions are about their actual usage and I'm looking for a conceptually understanding
This question already has an answer here:
What is the difference between inherits and implements in C#
5 answers
c# oop
c# oop
edited Dec 28 '18 at 21:41


Erik Philips
40.3k690123
40.3k690123
asked Dec 28 '18 at 21:22
Kathrine StackKathrine Stack
295
295
marked as duplicate by Rufus L
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 28 '18 at 21:42
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Rufus L
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 28 '18 at 21:42
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
2
If you are strict, inheritance does not include implementing an interface. Because a class implements (as you already noted yourself) an interface, it does not inherit from it. Now, humans sometimes are not very strict in their uses of words, and sometimes they use words in a fuzzy, ambiguous and sometimes even somewhat incorrect manner. (Fun fact: Interfaces can extend interfaces, so there is that to consider, too)
– elgonzo
Dec 28 '18 at 21:28
1
You inherit from base classes and implement interfaces. You can inherit from a base class without also extending it, though that's rather pointless to do so.
– Amy
Dec 28 '18 at 21:28
Oh, and by the way, there is a proposal for the next C# version (C# 8) about the support for default interface methods, which -- if that proposal would make it into C# 8 -- makes the distinction between interfaces and abstract classes a little less clear-cut (for a lack of a better term).
– elgonzo
Dec 28 '18 at 21:34
@elgonzo: They got that idea from Java; it's a terrible idea unless perhaps their intention is to bring back multiple inheritance in some form.
– Robert Harvey♦
Dec 28 '18 at 21:36
In any case, extension is the more general term for what happens when you implement an interface or inherit from a base class. It can also refer to something you put in your browser. Java uses theextends
keyword to indicate inheritance.
– Robert Harvey♦
Dec 28 '18 at 21:39
|
show 2 more comments
2
If you are strict, inheritance does not include implementing an interface. Because a class implements (as you already noted yourself) an interface, it does not inherit from it. Now, humans sometimes are not very strict in their uses of words, and sometimes they use words in a fuzzy, ambiguous and sometimes even somewhat incorrect manner. (Fun fact: Interfaces can extend interfaces, so there is that to consider, too)
– elgonzo
Dec 28 '18 at 21:28
1
You inherit from base classes and implement interfaces. You can inherit from a base class without also extending it, though that's rather pointless to do so.
– Amy
Dec 28 '18 at 21:28
Oh, and by the way, there is a proposal for the next C# version (C# 8) about the support for default interface methods, which -- if that proposal would make it into C# 8 -- makes the distinction between interfaces and abstract classes a little less clear-cut (for a lack of a better term).
– elgonzo
Dec 28 '18 at 21:34
@elgonzo: They got that idea from Java; it's a terrible idea unless perhaps their intention is to bring back multiple inheritance in some form.
– Robert Harvey♦
Dec 28 '18 at 21:36
In any case, extension is the more general term for what happens when you implement an interface or inherit from a base class. It can also refer to something you put in your browser. Java uses theextends
keyword to indicate inheritance.
– Robert Harvey♦
Dec 28 '18 at 21:39
2
2
If you are strict, inheritance does not include implementing an interface. Because a class implements (as you already noted yourself) an interface, it does not inherit from it. Now, humans sometimes are not very strict in their uses of words, and sometimes they use words in a fuzzy, ambiguous and sometimes even somewhat incorrect manner. (Fun fact: Interfaces can extend interfaces, so there is that to consider, too)
– elgonzo
Dec 28 '18 at 21:28
If you are strict, inheritance does not include implementing an interface. Because a class implements (as you already noted yourself) an interface, it does not inherit from it. Now, humans sometimes are not very strict in their uses of words, and sometimes they use words in a fuzzy, ambiguous and sometimes even somewhat incorrect manner. (Fun fact: Interfaces can extend interfaces, so there is that to consider, too)
– elgonzo
Dec 28 '18 at 21:28
1
1
You inherit from base classes and implement interfaces. You can inherit from a base class without also extending it, though that's rather pointless to do so.
– Amy
Dec 28 '18 at 21:28
You inherit from base classes and implement interfaces. You can inherit from a base class without also extending it, though that's rather pointless to do so.
– Amy
Dec 28 '18 at 21:28
Oh, and by the way, there is a proposal for the next C# version (C# 8) about the support for default interface methods, which -- if that proposal would make it into C# 8 -- makes the distinction between interfaces and abstract classes a little less clear-cut (for a lack of a better term).
– elgonzo
Dec 28 '18 at 21:34
Oh, and by the way, there is a proposal for the next C# version (C# 8) about the support for default interface methods, which -- if that proposal would make it into C# 8 -- makes the distinction between interfaces and abstract classes a little less clear-cut (for a lack of a better term).
– elgonzo
Dec 28 '18 at 21:34
@elgonzo: They got that idea from Java; it's a terrible idea unless perhaps their intention is to bring back multiple inheritance in some form.
– Robert Harvey♦
Dec 28 '18 at 21:36
@elgonzo: They got that idea from Java; it's a terrible idea unless perhaps their intention is to bring back multiple inheritance in some form.
– Robert Harvey♦
Dec 28 '18 at 21:36
In any case, extension is the more general term for what happens when you implement an interface or inherit from a base class. It can also refer to something you put in your browser. Java uses the
extends
keyword to indicate inheritance.– Robert Harvey♦
Dec 28 '18 at 21:39
In any case, extension is the more general term for what happens when you implement an interface or inherit from a base class. It can also refer to something you put in your browser. Java uses the
extends
keyword to indicate inheritance.– Robert Harvey♦
Dec 28 '18 at 21:39
|
show 2 more comments
1 Answer
1
active
oldest
votes
When you inherit, you now have relationships between the parent and derived class. Therefore, you have access to what the parent class offers. Example, the parent class has a function to add two numbers, well now the child class can use that function without having to implement its functionality. When you extend a class, you're taking that parent class and your adding to it. So in the derived class you added a new function that now allows you to subtract. Because of this inheriting and extending are interchangeable. When inheriting or extending a class you're not obligated to implement an interface because it's assumed that if you're working off an interface, the interface should of been implemented when you constructed the parent class. When you implement an interface it implies that the entire interface must be defined by whatever class implements it, whereas inheriting/extending implies parts of classed are being consumed.
Ahh okay. Makes sense. Thanks for the breakdown. It seems like there should be another word to encompass all of these as a "pillar of oop." Like Inheritance is a thing, but also extending a class is a thing. So with abstraction.. you extend an abstract class... but you could also JUST inherit it?
– Kathrine Stack
Dec 28 '18 at 22:40
@KathrineStack To use an analogy, say your distant relative dies and you inherit their estate. Once its yours, you have complete access to the entire estate, and you can therefore do whatever you want with it, but this doesn't mean you have to do anything with it. Once its yours, you can just sit on it. Inheritance doesn't necessitate extension, but it does make it possible.
– Amy
Dec 28 '18 at 22:46
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
When you inherit, you now have relationships between the parent and derived class. Therefore, you have access to what the parent class offers. Example, the parent class has a function to add two numbers, well now the child class can use that function without having to implement its functionality. When you extend a class, you're taking that parent class and your adding to it. So in the derived class you added a new function that now allows you to subtract. Because of this inheriting and extending are interchangeable. When inheriting or extending a class you're not obligated to implement an interface because it's assumed that if you're working off an interface, the interface should of been implemented when you constructed the parent class. When you implement an interface it implies that the entire interface must be defined by whatever class implements it, whereas inheriting/extending implies parts of classed are being consumed.
Ahh okay. Makes sense. Thanks for the breakdown. It seems like there should be another word to encompass all of these as a "pillar of oop." Like Inheritance is a thing, but also extending a class is a thing. So with abstraction.. you extend an abstract class... but you could also JUST inherit it?
– Kathrine Stack
Dec 28 '18 at 22:40
@KathrineStack To use an analogy, say your distant relative dies and you inherit their estate. Once its yours, you have complete access to the entire estate, and you can therefore do whatever you want with it, but this doesn't mean you have to do anything with it. Once its yours, you can just sit on it. Inheritance doesn't necessitate extension, but it does make it possible.
– Amy
Dec 28 '18 at 22:46
add a comment |
When you inherit, you now have relationships between the parent and derived class. Therefore, you have access to what the parent class offers. Example, the parent class has a function to add two numbers, well now the child class can use that function without having to implement its functionality. When you extend a class, you're taking that parent class and your adding to it. So in the derived class you added a new function that now allows you to subtract. Because of this inheriting and extending are interchangeable. When inheriting or extending a class you're not obligated to implement an interface because it's assumed that if you're working off an interface, the interface should of been implemented when you constructed the parent class. When you implement an interface it implies that the entire interface must be defined by whatever class implements it, whereas inheriting/extending implies parts of classed are being consumed.
Ahh okay. Makes sense. Thanks for the breakdown. It seems like there should be another word to encompass all of these as a "pillar of oop." Like Inheritance is a thing, but also extending a class is a thing. So with abstraction.. you extend an abstract class... but you could also JUST inherit it?
– Kathrine Stack
Dec 28 '18 at 22:40
@KathrineStack To use an analogy, say your distant relative dies and you inherit their estate. Once its yours, you have complete access to the entire estate, and you can therefore do whatever you want with it, but this doesn't mean you have to do anything with it. Once its yours, you can just sit on it. Inheritance doesn't necessitate extension, but it does make it possible.
– Amy
Dec 28 '18 at 22:46
add a comment |
When you inherit, you now have relationships between the parent and derived class. Therefore, you have access to what the parent class offers. Example, the parent class has a function to add two numbers, well now the child class can use that function without having to implement its functionality. When you extend a class, you're taking that parent class and your adding to it. So in the derived class you added a new function that now allows you to subtract. Because of this inheriting and extending are interchangeable. When inheriting or extending a class you're not obligated to implement an interface because it's assumed that if you're working off an interface, the interface should of been implemented when you constructed the parent class. When you implement an interface it implies that the entire interface must be defined by whatever class implements it, whereas inheriting/extending implies parts of classed are being consumed.
When you inherit, you now have relationships between the parent and derived class. Therefore, you have access to what the parent class offers. Example, the parent class has a function to add two numbers, well now the child class can use that function without having to implement its functionality. When you extend a class, you're taking that parent class and your adding to it. So in the derived class you added a new function that now allows you to subtract. Because of this inheriting and extending are interchangeable. When inheriting or extending a class you're not obligated to implement an interface because it's assumed that if you're working off an interface, the interface should of been implemented when you constructed the parent class. When you implement an interface it implies that the entire interface must be defined by whatever class implements it, whereas inheriting/extending implies parts of classed are being consumed.
answered Dec 28 '18 at 21:34
DDKGMDDKGM
82
82
Ahh okay. Makes sense. Thanks for the breakdown. It seems like there should be another word to encompass all of these as a "pillar of oop." Like Inheritance is a thing, but also extending a class is a thing. So with abstraction.. you extend an abstract class... but you could also JUST inherit it?
– Kathrine Stack
Dec 28 '18 at 22:40
@KathrineStack To use an analogy, say your distant relative dies and you inherit their estate. Once its yours, you have complete access to the entire estate, and you can therefore do whatever you want with it, but this doesn't mean you have to do anything with it. Once its yours, you can just sit on it. Inheritance doesn't necessitate extension, but it does make it possible.
– Amy
Dec 28 '18 at 22:46
add a comment |
Ahh okay. Makes sense. Thanks for the breakdown. It seems like there should be another word to encompass all of these as a "pillar of oop." Like Inheritance is a thing, but also extending a class is a thing. So with abstraction.. you extend an abstract class... but you could also JUST inherit it?
– Kathrine Stack
Dec 28 '18 at 22:40
@KathrineStack To use an analogy, say your distant relative dies and you inherit their estate. Once its yours, you have complete access to the entire estate, and you can therefore do whatever you want with it, but this doesn't mean you have to do anything with it. Once its yours, you can just sit on it. Inheritance doesn't necessitate extension, but it does make it possible.
– Amy
Dec 28 '18 at 22:46
Ahh okay. Makes sense. Thanks for the breakdown. It seems like there should be another word to encompass all of these as a "pillar of oop." Like Inheritance is a thing, but also extending a class is a thing. So with abstraction.. you extend an abstract class... but you could also JUST inherit it?
– Kathrine Stack
Dec 28 '18 at 22:40
Ahh okay. Makes sense. Thanks for the breakdown. It seems like there should be another word to encompass all of these as a "pillar of oop." Like Inheritance is a thing, but also extending a class is a thing. So with abstraction.. you extend an abstract class... but you could also JUST inherit it?
– Kathrine Stack
Dec 28 '18 at 22:40
@KathrineStack To use an analogy, say your distant relative dies and you inherit their estate. Once its yours, you have complete access to the entire estate, and you can therefore do whatever you want with it, but this doesn't mean you have to do anything with it. Once its yours, you can just sit on it. Inheritance doesn't necessitate extension, but it does make it possible.
– Amy
Dec 28 '18 at 22:46
@KathrineStack To use an analogy, say your distant relative dies and you inherit their estate. Once its yours, you have complete access to the entire estate, and you can therefore do whatever you want with it, but this doesn't mean you have to do anything with it. Once its yours, you can just sit on it. Inheritance doesn't necessitate extension, but it does make it possible.
– Amy
Dec 28 '18 at 22:46
add a comment |
0RZuJbiE86s4i56,sljeYpywezP,b x X,zYMp kHgLFEY0,8yZwT5Jd6rtICWEj3PltF3Jnb8
2
If you are strict, inheritance does not include implementing an interface. Because a class implements (as you already noted yourself) an interface, it does not inherit from it. Now, humans sometimes are not very strict in their uses of words, and sometimes they use words in a fuzzy, ambiguous and sometimes even somewhat incorrect manner. (Fun fact: Interfaces can extend interfaces, so there is that to consider, too)
– elgonzo
Dec 28 '18 at 21:28
1
You inherit from base classes and implement interfaces. You can inherit from a base class without also extending it, though that's rather pointless to do so.
– Amy
Dec 28 '18 at 21:28
Oh, and by the way, there is a proposal for the next C# version (C# 8) about the support for default interface methods, which -- if that proposal would make it into C# 8 -- makes the distinction between interfaces and abstract classes a little less clear-cut (for a lack of a better term).
– elgonzo
Dec 28 '18 at 21:34
@elgonzo: They got that idea from Java; it's a terrible idea unless perhaps their intention is to bring back multiple inheritance in some form.
– Robert Harvey♦
Dec 28 '18 at 21:36
In any case, extension is the more general term for what happens when you implement an interface or inherit from a base class. It can also refer to something you put in your browser. Java uses the
extends
keyword to indicate inheritance.– Robert Harvey♦
Dec 28 '18 at 21:39