Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7672775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:21:48+00:00 2026-05-31T16:21:48+00:00

i’ve been doing some research on interfaces and a simple layman’s explanation for what

  • 0

i’ve been doing some research on interfaces and a simple layman’s explanation for what it truly is. when searching through seas of books For some reason people love using overly complex explanations and jargon to explain truly simple concepts (guess it makes them feel big) and i have a gut feeling it’s the same in this case.

so from what i could grasp, it seems like interfaces are nothing more than a way to reserve method names, their return type if any, and the type and amount of arguments they accept. so when a class implements an interface (or interfaces) it is forced to define the body of each method from the interface(s). Am i on the nose with this one or do i need to keep digging?

p.s. i know javascript doesn’t have support for interfaces, but i still need to understand the concept because there are quite a few places where it’s shown how to emulate to an extent.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T16:21:49+00:00Added an answer on May 31, 2026 at 4:21 pm

    I explain the concept to lay people using an analogy that most people understand – plastic molding.

    The interface defines the shape of an object in the exact same way a mold will provide the shape of the finished product.

    You could inject a mold with White plastic, blue plastic, something exotic like an Epoxy or clay.

    What matters is, no matter what they are actually made of, they all have the same exact consistent shape to the purchaser of the product.

    For code, this means no matter what code is used to implement the interface, they all follow the same consistent contract/shape to the end user.

    I hope that might help a little.

    Edit –

    To extend the analogy to Abstract classes, imagine the next step in the molding process. You run a White, blue, and red plastic production run, but then each item needs to be painted at a separate factory, we just ship them out.

    The item is not finished, but it does have its shape defined. Someone later will come and fill out the details that our factory left blank.

    These items cannot be sold until they get that last painting step.

    In code, the abstract implementation of the interface provides some (or none) of the implementation, but leaves another descendant class to complete the contract, and in the same way no one can create an instance of the class until the contract has been completed.

    In the same way though, you can still refer to an abstract class in code, just like you can refer to the unpainted mold item as a “White molded thing” wither or not it is painted!

    Edit 2

    Here’s a short example

    void Main()
    {
        //IMold mold = new IMold(); // error - can't create instance of an interface
        //Fruit fruit = new Fruit(); // error - can't create instance of an abstract class
    
        Apple apple1 = new Apple(); // good
        Orange orange1 = new Orange(); // good
    
        Fruit apple2 = (Fruit)apple1; // good - Apples are fruit
        Fruit orange2 = (Fruit)orange1; // good - oranges are fruit
    
        IFruitMold apple3 = (IFruitMold)apple2; // good - Apples fit the Mold
        IFruitMold orange3 = (IFruitMold)orange2; // good - Oranges also fit the mold
    
    
        //now I can do this:
        //Notice that `fruits` is of type IList<T> but the new is List<T>
        //This is the exact concept we are talking about
        //IList<T> is some kind of set of items that can be added or subtracted from
        //but we don't have to care about the implementation details of *HOW* this is done
        IList<IFruitMold> fruits = new List<IFruitMold>();
        fruits.add(apple3);
        fruits.add(orange3);
    
        foreach( var fruit in fruits )
        {
            fruit.PlasticColor.Dump(); // ok I can read
            fruit.PlasticColor = ""; // error - no Set defined in the interface
    
            // depending on the **implementation details** of what type of fruit this is true or false
            // we don't care in the slightest, we just care that we have some IFruitMold instances
            fruit.RequiresPainting.Dump(); 
        }
    }
    
    interface IFruitMold
    {
        string PlasticColor { get; }
        bool RequiresPainting { get; }
    }
    
    abstract class Fruit : IFruitMold
    {
        private string m_PlasticColor = string.Empty;
        public string PlasticColor { get; private set; }
        public abstract bool RequiresPainting { get; }
    }
    
    //notice that we only define the abstract portion of the base class
    //it defined PlasticColor for us already!
    //the keyword `override` is required  - it is to make it clear that 
    //this member is overriding a member from it's parent.
    class Apple : Fruit
    {
        public override bool RequiresPainting { get { return true; } }
    }
    
    class Orange : Fruit
    {
        public override bool RequiresPainting { get { return false; } }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am doing a simple coin flipping experiment for class that involves flipping a
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Seemingly simple, but I cannot find anything relevant on the web. What is the
I am trying to loop through a bunch of documents I have to put
I'm making a simple page using Google Maps API 3. My first. One marker

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.