|
![](/i/fill.gif) |
Warp wrote:
> Darren New <dne### [at] san rr com> wrote:
>> Sure. But people are discussing .h files, where there's no such option in
>> C++. In C, you could make the function static, but that's not the same thing
>> for a C++ method.
>
> How would you suggest having support for implementing private functions for
> a class without having to declare them in the class declaration *and* without
> opening the private parts of the class to any external code that wishes to
> access it?
I don't know. C# does it by not having header files. I'm not saying C++'s
solution is a bad one per se. (*I* don't like it as much, but that doesn't
mean it's *bad* universally.)
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.
> 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.
> 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.)
--
Darren New, San Diego CA, USA (PST)
I ordered stamps from Zazzle that read "Place Stamp Here".
Post a reply to this message
|
![](/i/fill.gif) |