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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:35:54+00:00 2026-06-04T09:35:54+00:00

I am using an interface reference variable to access the properties on an Interface

  • 0

I am using an interface reference variable to access the properties on an Interface

But in addition to that the class that implements the interface has its own attributes.

I am unable to access the class attributes through this interface reference.

Here are my questions:

1) why is that so?

2) What is the solution to the problem? Is there any way i can access the coolant power variable in AC class through machine only? Will a TYPE CAST work?

 interface IMachines
{
    #region properties
    int machineID { get; set; }
    static int totalID { get; set; }
    string name { get; set; }
    string make { get; set; }
    int weight { get; set; }
    int cost { get; set; }
    int warranty { get; set; }
    DateTime creationDate { get; set; }
    #endregion

    int generateWarrantyExpiry();
    int searchMachine();
}

public class AC:IMachines
{
    #region ACMembers

    protected int _machineID;
    protected string _name;
    protected int _weight;
    protected string _make;
    protected DateTime _creationDate;
    protected int _warranty;
    protected int _cost;
    public int _coolentPower;

    public int CoolentPower
    {
        get { return _coolentPower; }
        set { _coolentPower = value; }
    }

    #endregion




    #region IMachines Members

    public int machineID
    {
        get { return _machineID; }
        set { _machineID = value; }
    }

    public string name
    {
        get { return _name; }
        set { _name = value; }
    }

    public string make
    {
        get { return _make; }
        set { _make = value; }
    }

    public int weight
    {
        get { return _weight; }
        set { _weight = value; }
    }

    public int cost
    {
        get { return _cost; }
        set { _cost = value; }
    }

    public int warranty
    {
        get { return _warranty; }
        set { _warranty = value; }
    }

    public DateTime creationDate
    {
        get { return _creationDate; }
        set { _creationDate = value; }
    }

    public int searchMachine()
    {
        //Search machine logic to be implemented
return 2
    }

    public void GenerateWarranty()
{
//generate warranty logic to be implemented

}

    #endregion
}

}

  • 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-04T09:35:55+00:00Added an answer on June 4, 2026 at 9:35 am

    Note that using a cast, as many answerers have suggested, will break the abstraction offered by the IMachines interface.

    If it’s true that you’ll only ever be using the one type that implements the interface, AC, then this will work, but if you ever want to support some other type of IMachines, things may break down.

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

Sidebar

Related Questions

If I release the object that's holding a reference to the variable that I
I have a method as follows (from a class than implements TBB task interface
On my WinForm, a reference is created: using System.Runtime.InteropServices.ComTypes; When a variable is declared:
For School I have been given a class interface to define my own array
I m trying to get the annotation details from super type reference variable using
Here is part of a class definition in an iOS program using reference counting
I created a label using Interface Builder, and now I want to set the
I am using Interface Builder to play around with some ideas. I never noticed
can we implement polymorphism using interface in c#? any example .
I'm trying to avoid using Interface Builder as much as possible. At the moment

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.