Why cant we create Object if constructor is in private section?
- by Abhi
Dear all
I want to know why cant we create object if the constructor is in private section. I know that if i make a method static i can call that method using               
<classname> :: <methodname(...)>;
But why cant we create object is my doubt...
I also know if my method is not static then also i can call function by the following...
class A
{
     A();
     public:
        void fun1();
        void fun2();
        void fun3();
};
int main()
{
     A *obj =(A*)malloc(sizeof(A));
     //Here we can't use new A() because constructor is in private 
     //but we can use malloc with it, but it will not call the constructor
     //and hence it is harmful because object may not be in usable state.
     obj->fun1();
     obj->fun2();
     obj->fun3();
}
So only doubt is why cant we create object when constructor is in private section?
Thanks in advance