Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
4
Reply
Dervied class Constructor value pass to parent class
Seshadri M
Sep 18 2017 3:03 AM
186
Reply
I am trying to pass the value from child class to parent class constructor. But
class Class1
{
public Class1(int a, int b) {
this.a = a;
this.b = b;
Console.WriteLine("parentconstructor");
}
}
class Class2: Class1 {
public Class2(int a, int b): base(a, b) {
Console.WriteLine("childconstructor");
}
}
class program
{
class2 obj =new class2( 4,5);
Console.ReadLine();
}
//OUTPUT
//Parentconstructor
//childconstriuctor
// But excepted child constructor first an second parentconstructor
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
4
)
Next Recommended Forum
Extract handwritten part from the Document
How to use web view in tappedlink