I have a simple question:
class my
{
};
my ob;
Compiler allows me to create an object which makes sense. And, I am aware that you can't create object where the constructor is private.
To me it looks that, everything inside the class is private
but obviously not the default constructor(because it is allowing me to create the object as default constructor should be public
). But what confuses me is that there is no public
section in the class.
So, does it create a public
section only to put a default constructor under it in this case?
Or there is something else going on and my rationale is incorrect?
Also, how are accesses public, private and protected internally organised/tracked when an object is created/accessed?
I got this question as I never created an object of an empty class until now.
public
. You have to actively do stuff to disallow them. – Privation