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 252965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T21:43:19+00:00 2026-05-11T21:43:19+00:00

Let me explain. I have defined an interface named IEmployee (ID, FirstName and Surname

  • 0

Let me explain. I have defined an interface named IEmployee (ID, FirstName and Surname properties) but I have not yet implemented that interface in any class.

What I want to do is something like:

Dim User as New IEmployee
User.ID = 1
User.FirstName = ""
User.Surname = ""

Call SomeFunction (User)

The VB.NET complier does not seem to like this.

EDIT** Thanks all, all good points well made! I’ll instantiate a concrete class. I was just trying to take a shortcut 🙂

  • 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-11T21:43:20+00:00Added an answer on May 11, 2026 at 9:43 pm

    No, it wouldn’t. You can’t create instances of interfaces directly like this: what would you expect the property calls to do? Property calls invoke code – but you haven’t provided an implementation. Suppose you’d define a method in the interface to calculate the employee’s holiday allowance: what would you expect that to do if you called it, when you haven’t implemented the interface anywhere?

    The point of an interface is to specify an API that is then implemented in concrete classes – you can’t use the interface without something implementing it properly.

    (Note that I think there are some really weird situations in which the C# compiler and possibly the VB one will allow you to instantiate interfaces directly, but I think they’re COM-specific situations. I assume this isn’t to do with COM. There are also things like RealProxy which implement interfaces dynamically etc, but again I don’t think it’s directly relevant.)

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

Sidebar

Related Questions

First let me explain. I have several addresses on the page that I put
The title may have been confusing, but please let me explain: Currently when I
Let me explain my situation. I have made a user control that contains an
This question might not seem programming related at first, but let me explain. I'm
this is kind of a strange title, so let me explain: We have a
let me explain my current situation i have a SharePoint site lets say it
Let me explain what I mean : Let's say we have a menu with
I have a problem with Facebook. Let me explain what I'm trying to do.
I have two examples I have a question about. Let me explain via some
OK, let me explain... I have an NSString and a path stored in it,

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.