Answer the question
In order to leave comments, you need to log in
What is substitution in OOP?
Hello. Substitution in object-oriented programming, tobish overrideng is a redefinition. Override = polymorphism. Tobish substitution = polymorphism.
So the question "The concept of substitution in OOP" is the question "The concept of polymorphism in OOP"?
Thanks to everyone who replies =)
Answer the question
In order to leave comments, you need to log in
Polymorphism is one of the three fundamental principles of the OOP paradigm.
Overriding (also "overriding" or "overriding" methods) is a generic name for the mechanism provided by the PL to support the application of this principle when designing class hierarchies.
The specific details of the implementation of the mechanism may differ (as, for example, in Java and JS), but the essence of the so-called. OOP remains the same. But in C, for example, there is no such mechanism at all, but this does not prevent (just does not help!) Writing object-oriented code in this language .
So, if overriding is meant by "replacement", I would not identify the goal and the means to achieve it so broadly :)
Perhaps you are talking about this:
class Фигура:
virtual void нарисоватьСебя() = 0;
class Круг : public Фигура:
virtual void нарисоватьСебя() {
// код рисующий круг
}
class Квадрат : public Фигура:
virtual void нарисоватьСебя() {
// код рисующий квадрат
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question