Tech
Forums
Jobs
Books
Events
Live
Interviews
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
2
Reply
How to invoke or instantiate obj using private constructor?
Abid Khan
Jan 20 2015 6:21 AM
746
Reply
Hello, i would like to know how to instantiate an object using private constructor? and what are the main benefits to use private constructor?
namespace Practice
{
public class Test
{
int a;
public Test()
{
}
private Test(int a)
{
this.a = a;
}
}
public class Test2
{
void method()
{
Test obj1 = new Test();
}
}
}
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
2
)
Next Recommended Forum
viewing sms in system
I want to write a program in C does the following