Home > OS >  I couldn't define "GetProperties" to other class
I couldn't define "GetProperties" to other class

Time:03-12

enter image description here

How can ı fix ?

CodePudding user response:

The bottom image shows kedi.GetProperties, but the top images shows the definition of GetProperties() on the Hayvan class. If the definition of GetProperties() is the same on Kedi as it is on Hayvan then you will need to make the definition static to access it in the way you have.

CodePudding user response:

You forgot the () after the method called, if this doesn't fix it, continue to follow the comment Seems like you are creating a variable of type Kedi and then you try from that to use a method from the class hayvan, you should try something like this:
Inside Program.cs:

Hayvan test = new Hayvan() { //Insert eventual values };
Console.WriteLine(test.GetProperties());

But before doing that create an empty contructor inside Hayvan using the ctor shortcut or manually, let me know if this will fit it P.S: Next time add the code using a codeBlock from the editor instead of an image, so we can copy and test ;-)

  • Related