# Redeclaration clash with private classes

**URL:** <https://discuss.kotlinlang.org/t/redeclaration-clash-with-private-classes/21198>\
**Category:** Support\
**Created:** [March 14, 2021, 9:04am UTC](https://discuss.kotlinlang.org/t/redeclaration-clash-with-private-classes/21198 "2021-03-14T09:04:17Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![roland.schuetzig](https://avatars.discourse-cdn.com/v4/letter/r/82dd89/32.png) [@roland.schuetzig](https://discuss.kotlinlang.org/u/roland.schuetzig)\
**Post date:** [March 15, 2021, 4:07am UTC](https://discuss.kotlinlang.org/t/redeclaration-clash-with-private-classes/21198/5 "2021-03-15T04:07:21Z")

</div>

The use case is as follows. Say I am exploring some idea and have several versions of it in work in parallel. So I open a new file and call it for example 'Version04". Then I introduce the same class (at top level) as shown above as a routine and start writing functions. By the way: I do not have a collision with function names, as long as I mark them private.  
So, I could definetely introduce a class “Version04” and have the rest within that class. But it would over time lead me away from using top level objects in general. I think the ‘private’ marking should be more effective in keeping _anything_ marked as private just that: private and never visible or effective in any way outside the file.  
I understand the behaviour now a bit better and there might be some underlying architectural reason, why it can’t be different. I just wonder why it is implemented that way and would like to understand why.

---

_[View the full topic](https://discuss.kotlinlang.org/t/redeclaration-clash-with-private-classes/21198)._
