For example, in classical OOP, we have to deal with interfaces
We only have to deal with interfaces when they are implemented as an entry to a function or method.
Consider this in C#
// Classes have implicit interface definitions// plus the ability to create a new object of that typepublicclassPerson{// implicit interface properties of...stringlastName;stringfirstName;}// if there's a method anywhere in the project like this:setName(Personperson){// the parameter is a concrete Person object// that has implicit interfaces of lastName and firstName properties.}// but what about this?setName(iPersonperson){}// and assume this:// a definition of an interfaceinterfaceIPerson{stringlastName;stringfirstName;}// here we have the same exact thing happening, // but the parameter is asking for an object of type interface// and not a concrete person object.// The only difference is that we cannot create a new instance of an interface. // To do that we'd need this.// Change Person to implement the interfaceclassPerson:IPerson{stringlastName;stringfirstName;}//create a new person object which passes the interface testvarperson=newPerson()// Works due to our Person Class// implementation of iPersonsetName(iPersonperson){}
Sound confusing? Why would we do this on just a person model class? Answer: We wouldn't, because the Person class with just 2 properties is sufficient and the interface is implicit.
There's two types of inheritance 'classical' which is vertical nature, it deals with classes, and subclasses. The interface (explicit or implicit) is 'horizontal in nature' and is seen as the ability to pass something in to be contained, it can be done via parameters or by object placeholders with the class or function. The concepts of composition use the horizontal style while classical inheritance is the vertical style.
It all boils down to one simple concept, can I morph my object in such a way that I can only see the properties or functions I want? If the answer is yes then we are using some form on inheritance/composition.
BTW, I saw that video years ago and disagreed with the general conclusions then.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Sound confusing? Why would we do this on just a person model class? Answer: We wouldn't, because the Person class with just 2 properties is sufficient and the interface is implicit.
There's two types of inheritance 'classical' which is vertical nature, it deals with classes, and subclasses. The interface (explicit or implicit) is 'horizontal in nature' and is seen as the ability to pass something in to be contained, it can be done via parameters or by object placeholders with the class or function. The concepts of composition use the horizontal style while classical inheritance is the vertical style.
It all boils down to one simple concept, can I morph my object in such a way that I can only see the properties or functions I want? If the answer is yes then we are using some form on inheritance/composition.
BTW, I saw that video years ago and disagreed with the general conclusions then.