How to call a method from another inherited class in c# -
this question has answer here:
- what nullreferenceexception, , how fix it? 33 answers
i have class , method below
public class wakeup : world { public void methoda(string) { log.writeline("wakeup world"); } }
and below 1 class , method in trying call "methoda"
public class hello : world { public void methodb() { wakeup p = new wakeup; p.methoda(string); } }
this isn't working. unable call "methoda" inside "methodb"
note : both classed inherited other class called "world"
can suggest me how can achieve ?
create instance of first class inside second 1 correctly, pass string value
instead string type
in second class method call
public class wakeup : world { public void methoda(string text) { log.writeline(text); } } public class hello : world { public void methodb() { wakeup p = new wakeup(); p.methoda("wakeup world"); } }
Comments
Post a Comment