✏️ Explanatory Question

Can static methods call private constructors?

👁 1 Views
📘 Detailed Answer
🟢 Easy
1
Total Views
10
Related Qs
0%
Progress
💡

Answer with Explanation

Yes.

In X++, methods within the same class can access private members regardless of whether they are static or instance methods.

A static method can call:

new MyClass();

Even if the constructor is marked private.

This feature is commonly used in the Singleton pattern to control object creation.