Yes, sorry asking for stupid question n00b. So I have a C # program. I have a class
class foo { public int bar, wee, someotherint, someyetanotherint; public foo() { this.bar = 1: this.wee = 12; this.someotherint = 1231; this.someyetanotherint = 443; } }
And I want to create a class called spleen that inherits from foo
class spleen : foo { }
What is the fastest and easiest syntax to make the spleen class inherit the constructor from foo without having to copy / paste the entire constructor from foo? I do not want to hear that I already have too many parameters. I already know that. (edit: Actually, no, I'm an idiot) I know that I have to somehow call the parent constructor, but I don't know how to do this. How to do it.
Edit: Now I understand that I needed more time to write my question. It seems that I tried to ask two questions at the same time, without realizing it (how to inherit constructors without parameters, and how to inherit constructors with parameters), and somehow mixed up all this. However, the answers provided were very helpful and solved my problem. Thank you and wish I were such an idiot!
inheritance constructor c #
user118380
source share