---
title: "Can you declare a private class in a namespace?"  
description: "Can you declare a private class in a namespace?"  
author: "Sumit Kesarwani"  
published: 2014-09-04  
updated: 2020-09-15  
canonical: https://www.mindstick.com/interview/2137/can-you-declare-a-private-class-in-a-namespace  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Can you declare a private class in a namespace?

The classes in a namespace are internal, by default. However, you can explicitly declare them as public only and not as private, protected, or protected internal. The nested classes can be declared as private, protected, or protected internal.

## Answers

### Answer by Sumit Kesarwani

The classes in a namespace are internal, by default. However, you can explicitly declare them as public only and not as private, protected, or protected internal. The nested classes can be declared as private, protected, or protected internal.


---

Original Source: https://www.mindstick.com/interview/2137/can-you-declare-a-private-class-in-a-namespace

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
