#INTERFACES

5 messages · Page 1 of 1 (latest)

stable ferry
#

Hello, can someone explain me the diference betwen Interfaces and heritage?

loud lodgeBOT
#

This post has been reserved for your question.

Hey @stable ferry! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

light shoal
#

inheritance → Like Family Traits
You inherit traits from your parents—maybe your dad’s height or your mom’s eye color. Similarly, a class inherits properties and behaviors from a parent class. You don’t have to redefine them; they’re just passed down.

Interfaces → Like a Job Requirement
A company doesn’t care about your last name; they need you to have certain skills. To be a pilot, you must know how to fly a plane. To be a chef, you must know how to cook. An interface is just a contract that says, “If you want to be in this category, you must have these methods.”

So, inheritance is like getting traits from your parents, while an interface is like meeting job requirements!

#

i hope that helps