Deepha Balachandran
Whats is the use of a private constructor? Calling non- static method from a static class, Is this possible?
By Deepha Balachandran in C# on Sep 08 2016
  • Manju Kaniappan
    Sep, 2017 6

    1.We can prevent object creation from outsider class when we have only Private Constructor(s). 2. Create an instance of non static's method's class and invoke nonstatic method

    • 0
  • Manju Kaniappan
    Sep, 2017 6

    1.We can prevent object creation from outsider class when we have only Private Constructor(s). 2. Create an instance of non static's method's class and invoke nonstatic method

    • 0
  • Mukesh Kumar
    Sep, 2017 4

    Yes

    • 0
  • sushil kumar
    Jul, 2017 20

    you can call non-static method from static method. See example public class MyClass {private void data1(){}private static void data2(){MyClass c = new MyClass();c.data1();} }

    • 0
  • Ayappan Alagesan
    Feb, 2017 10

    Not Possible.Class cannot have private constructor and static class cannot have non static method.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS