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

  • Home
  • SEARCH
  • 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 8962593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:09:44+00:00 2026-06-15T16:09:44+00:00

I recently read in Professional C# 4 and .NET 4 that: You can never

  • 0

I recently read in “Professional C# 4 and .NET 4” that:

You can never instantiate an interface.

But periodically I see things like this:

IQuadrilateral myQuad;

What are the limitations in using interfaces directly (without having a class inherit from the interface)? How could I use such objects (if they can even be called objects)?

For example instead of using a Square class that derives from IQuadrilateral, to what extent could I get away with creating an interface like IQuadrilateral myQuad?

Since interfaces don’t implement methods, I don’t think I could use any methods with them. I thought interfaces didn’t have fields to them (only properties), so I’m not sure how I could store data with them.

  • 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-06-15T16:09:46+00:00Added an answer on June 15, 2026 at 4:09 pm

    The answer is simple, you can’t instantiate an interface.

    The example you provided is not an example of instantiating an interface, you are just defining a local variable of the type IQuadrilateral

    To instantiate the interface, you would have to do this:

    IQuadrilateral myQuad = new IQuadrilateral();
    

    And that isn’t possible since IQuadrilateral does not have a constructor.

    This is perfectly valid:

    IQuadrilateral myQuad = new Square();
    

    But you aren’t initiating IQuadrilateral, you are initiating Square and assigning it to a variable with the type IQuadrilateral.

    The methods available in myQuad would be the methods defined in the interface, but the implementation would be based on the implementation in Square. And any additional methods in Square that are not part of the IQuadrilateral interface would not be available unless you cast myQuad to a Square variable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently read this blog entry by Hadi Hariri: That dreaded M in ASP.NET
I recently read somewhere (I am really sorry I can't provide the source) that
I recently read in this tutorial that certain jQuery leaks are trackable through the
I recently read about http://php.net/pcntl and was woundering how good that functions works and
I recently read that php applications can be deployed on Google App Engine using
I recently read a text regarding buffer overflows that mentioned that setting breakpoints can
I recently read that you can predict the outcomes of a PRNG if you:
I recently read that Java now sports initialisation blocks like the following: class C
I recently read a lot about preventing heap allocation for a class (see this
I recently read a blog in Nodejitsu and I am wondering how this piece

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.