1

Topic: What for inheritance is necessary

I walk here on interviews. And here already twice me asked what for inheritance is necessary. The answer that for the extension and redefinition of a functional of base classes did not suit them. As an example I start to result the set dresser, C# extension methods and.. . Something I cannot even  what answer there it was expected.

2

Re: What for inheritance is necessary

Hello, BlackEric, you wrote: I would answer that for  the interface. For example, COM. You do not know that inside, but know that supports this or that interface and can already work with it.

3

Re: What for inheritance is necessary

Hello, Amon_RA, you wrote: A_R> Hello, BlackEric, you wrote: A_R> I would answer that for  the interface. For example, COM. You do not know that inside, but know that supports this or that interface and can already work with it. It is not assured. In a C ++ interfaces are not present, and inheritance is.

4

Re: What for inheritance is necessary

Hello, BlackEric, you wrote: BE> I Walk here on interviews. And here already twice me asked what for inheritance is necessary. BE> the answer that for the extension and redefinition of a functional of base classes did not suit them. As an example I start to result the set dresser, C# extension methods and.. . LSP - enters into five principles of OOP - SOLID. BE> Something I cannot even  what answer there it was expected. Here the Unified State Examination generation also grew, avoiding to think and reflect.

5

Re: What for inheritance is necessary

Hello, iZEN, you wrote: ZEN> Hello, BlackEric, you wrote: BE>> I Walk here on interviews. And here already twice me asked what for inheritance is necessary. BE>> the answer that for the extension and redefinition of a functional of base classes did not suit them. As an example I start to result the set dresser, C# extension methods and.. . ZEN> https://ru.wikipedia.org/wiki/___ ZEN> - enters into five principles of OOP - SOLID. And it is possible more in detail that I did not understand communication of a principle of substitution and inheritance.

6

Re: What for inheritance is necessary

Hello, BlackEric, you wrote: BE> Something I cannot even  what answer there it was expected. For reduction save-paste.

7

Re: What for inheritance is necessary

I not  and simply ask that it was expected to hear truth, I and walk, lately,   the fan * the majority of cases, long I neigh (not aloud)

8

Re: What for inheritance is necessary

Was already tired to repeat, not  if want to employ, employ even without experience or badly solved job

9

Re: What for inheritance is necessary

About   ask normally in a context about , , designing patterns  though it would be possible to answer type - inheritance is necessary for reduction of redundancy but it is all a different corner on one and  a point that nobody expected in the answer  learns

10

Re: What for inheritance is necessary

BE> inheritance 1) for DRY ("Each part of knowledge should have unique, consistent and authoritative idea within the limits of system") what for is necessary - the general for different successors the code is implemented in their ancestor, at the same time and the general data fields in it are described (normally when all classes are written by one programmer) 2) (that that you actually answered) for convenience of the extension by an openness/closeness principle - O in SOLID (normally when successors are written already by other programmer)

11

Re: What for inheritance is necessary

Hello, iZEN, you wrote: BE>> I Walk here on interviews. And here already twice me asked what for inheritance is necessary. BE>> the answer that for the extension and redefinition of a functional of base classes did not suit them. As an example I start to result the set dresser, C# extension methods and.. . ZEN> LSP - enters into five principles of OOP - SOLID. It not the reason of usage of inheritance, and restriction on this usage. BE>> Something I cannot even  what answer there it was expected. ZEN> here the Unified State Examination generation also grew, avoiding to think and reflect. And what generation differs inability to read a question and answers what was not asked?

12

Re: What for inheritance is necessary

Before asking a question "What for inheritance is necessary?", asked "That such inheritance?"?

13

Re: What for inheritance is necessary

BE> I Walk here on interviews. And here already twice me asked what for inheritance is necessary. It is one of receptions of a reuse of the code. BE> the answer that for the extension and redefinition of a functional of base classes did not suit them. As an example I start to result the set dresser, C# extension methods and.. . Repeated  the code it is a lot of receptions, comparative efficiency strongly depends on the executor, everyone can have a favourite toolkit. BE> Something I cannot even  what answer there it was expected. It is necessary to guess and sing esteemed by these  mantras and patterns.

14

Re: What for inheritance is necessary

Hello, BlackEric, you wrote: A_R>> I would answer that for  the interface. For example, COM. You do not know that inside, but know that supports this or that interface and can already work with it. BE> it is not assured. In a C ++ interfaces are not present, and inheritance is. If to follow classics of a genre of a C ++ it is considered that the interface in it it: 1. Open members of a class 2. The template of designing Both that and another in a C ++ easily implementablly and as a matter of fact is basic concepts. There is no only special keyword, as in some other known programming languages. Though if to take more advanced implementations such as Qt, it is necessary to mark that there interfaces left far forward, in particular it is well visible in .

15

Re: What for inheritance is necessary

Hello, Amon_RA, you wrote: A_R> I would answer that for  the interface. For example, COM. You do not know that inside, but know that supports this or that interface and can already work with it. It is not so simple inheritance, and it is more polymorphism. But time they have been mentioned, it is possible to ask still and about encapsulation. Though on the other hand what for to ask. All can it is occasion reflect, there can be an inheritance and it is not necessary at all and to use more effectively aggregation, and even at all to pass to other programming paradigm, that is not OOP. By and large inheritance is concept from the material logic, therefrom programmers and took it and many other things.

16

Re: What for inheritance is necessary

Hello, BlackEric, you wrote: BE> I Walk here on interviews. And here already twice me asked what for inheritance is necessary. That is reserved to increase connectivity and to add unobvious interactions. To decorate with casual overlappings of functions of base class.

17

Re: What for inheritance is necessary

ZEN> LSP - enters into five principles of OOP - SOLID. Actually inheritance is used for two things: interface inheritance (and here LSP  because such inheritance says that the derivative class is also basic too). The compiler supports implicit coercion of derived type to the basic. For more basic principle - a code reuse (and also closeness to change and an openness to the extension). Here private inheritance (which including implicit coercion of a derivative class to basic forbids) is used. In this case LSP does not work (though all same inheritance is used, but fans LSP at all do not understand such variant, therefore chorus tell fairy tales that something "strange" and "it is not necessary so to do it" though there are no reasons not to use the tool there where it approaches). It just that case when the square can be inherited from a rectangle (if inheritance from Shape is not required). It is often replaced with encapsulation because so it is more clear. P.S. It is all was about a C ++ (though it is basic principles of the OOP, which general-purpose).

18

Re: What for inheritance is necessary

Hello, Cyberax, you wrote: a C> to Decorate with casual overlappings of functions of base class. Or intended. I had to see, when use inheritance only because in a heritable class there is a suitable method. .

19

Re: What for inheritance is necessary

BE> I Walk here on interviews. And here already twice me asked what for inheritance is necessary. BE> the answer that for the extension and redefinition of a functional of base classes did not suit them. As an example I start to result the set dresser, C# extension methods and.. . BE> Something I cannot even  what answer there it was expected. At me tomorrow just interview, here also I will ask the candidate

20

Re: What for inheritance is necessary

Hello, Qt-Coder, you wrote: QC> Hello, BlackEric, you wrote: BE>> Something I cannot even  what answer there it was expected. QC> for reduction save-paste. Badly thought over inheritance only increases an amount . "And if it would be desirable to redefine behavior of the successor, it is necessary to take 99 % of the code from a method of the ancestor and to wedge the of 1 % there where it is necessary" Actually, patterns from GoF/Fowler/etc just about it: a dial-up typical scenarios which appear at exarticulation of entities, and as not  with it in the code.

21

Re: What for inheritance is necessary

I somehow tried to begin that it is necessary to distinguish inheritance of implementation and interface inheritance.  it, in the core, such  reusage method. The second - , " the contract" or somehow so. Like would be happy and even quickened somehow.

22

Re: What for inheritance is necessary

Hello, BlackEric, you wrote: BE> I Walk here on interviews. And here already twice me asked what for inheritance is necessary. BE> the answer that for the extension and redefinition of a functional of base classes did not suit them. Inheritance is: - a method of implementation parametric (on one argument) run-time polymorphism in many languages; - a convenient method of a reuse of the code in the same languages. I.e. you are right, and they are not present. BE> As an example I start to result the set dresser, C# extension methods and.. . It would be better to ask examples them for an explanation you. Then though it was possible to try to guess, what it is is specific at these chaps a sight at things.))

23

Re: What for inheritance is necessary

Hello, Cyberax, you wrote: BE>> I Walk here on interviews. And here already twice me asked what for inheritance is necessary. A C> That is reserved to increase connectivity and to add unobvious interactions. To decorate with casual overlappings of functions of base class. It is true for any method of implementation of parametric polymorphism. Even as it is in the functional languages, type of Haskelja. You suggest to refuse parametric polymorphism at all?))

24

Re: What for inheritance is necessary

Hello, Privalov, you wrote: a C>> to Decorate with casual overlappings of functions of base class. P> or intended. I had to see, when use inheritance only because in a heritable class there is a suitable method. .  design here it is orthogonal to tool characteristics. To stick a hogwash it is possible in any technics.

25

Re: What for inheritance is necessary

Hello, vdimas, you wrote: V> Hello, Cyberax, you wrote: BE>>> I Walk here on interviews. And here already twice me asked what for inheritance is necessary. A C>> That is reserved to increase connectivity and to add unobvious interactions. To decorate with casual overlappings of functions of base class. V> it is true for any method of implementation of parametric polymorphism. V> even as it is in the functional languages, type of Haskelja. V> you Suggest to refuse parametric polymorphism at all?)) "Object-oriented lies" - https://www.youtube.com/watch?v=lfdAwl3-X_c