A question about the relation between different module.

Jarrett Billingsley jarrett.billingsley at gmail.com
Tue Nov 11 07:58:58 PST 2008


On Tue, Nov 11, 2008 at 10:53 AM, Yonggang Luo <yonggangluo at hotmail.com> wrote:
> I have a file that named
> baseClass.d
> The content is
> module baseClass;
>
> public class Base
> {
> }
>
> public void Function()
> {
> }
>
>
> private class BaseAlternative
> {
> }
>
> private void FunctionAlternative()
> {
> }
>
> And the other file that named
> subClass.d
> The content is
> module subClass;
> private import baseClass;
>
> class Sub:Base /*Is this legal?*/
> {
> };

Of course it's legal.  "Base" is public.

> void DoSomeThins()
> {
>        Function(); /*Is this legal?*/
> }

Again, yes, this is legal, since "Function" is public.

Anything that is public is accessible from other modules.



More information about the Digitalmars-d mailing list