can we declare private class in namespace?

No we can declare private class in namespace, it will give compile time error.

Example:

namespace example
{
private class ex //error
{
}
}

“Error: Elements defined in a namespace cannot be explicitly declared as private, protected, or protected internal”

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*