Passing a Class Object to a Function that has an Interface argument

Ronald Rex 101 Reputation points
2022-12-05T16:45:03.267+00:00

I am passing a Class Object to a Method that takes an Interface as a Paramater. I was wondering why I cannot see my Class properties inside of this method? I only see the Interface Properties and Methods. Thanks !!!!

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,274 questions
{count} votes

Accepted answer
  1. AgaveJoe 29,776 Reputation points
    2022-12-05T16:59:11.647+00:00

    Like your other post, we cannot see your code! If you can only see the interface properties then you must have defined the method parameter as the Interface. That's how interfaces work!

    267238-capture.png

    Share your code if this does not answer your question. Also, while it is possible to define a property interface it is not all that common. Usually, method that perform an action are Interfaces.

    Interfaces - define behavior for multiple types

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.