|
![](/i/fill.gif) |
Darren New <dne### [at] san rr com> wrote:
> I don't know. C# does it by not having header files.
Well, nothing stops you from implementing everything *in* the class
declaration in C++. (Well, except if you want to keep some degree of
modularity.)
> I'm merely pointing out that it's hypocritical to claim that it's better to
> *have* to maintain something manually because then you're not dependent on a
> tool to maintain it.
I don't see separate declarations and implementations as such a big problem
as you seem to.
> > The solution to this is to specify the private functions in the class
> > declaration.
> Or not have class declarations at all. If you define it private, then it's
> private. You don't need to declare it at all, public or private.
How do you stop someone from adding a new private function to your class
from the outside, then?
> > If you don't care about privacy, then put everything in the public section
> > of the class and write all the formerly private functions in a nameless
> > namespace inside the source file.
> That doesn't work for instance methods, does it? An instance method
> actually has to be a member of the class in the class declaration, yes? (I'm
> just double-checking I understand that part.)
Well, if everything is public, what do you need private methods for?
Private methods are only for access, but if access is already completely
open, then there's no need for private methods. You can replace them with
local functions (ie. local to the compilation unit, ie. in a nameless
namespace).
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |