U
Unemployed VC++ guy
I have been playing around with C#, and rading some books: "Understanding
..NET" by David Chappell, and "Fast Track C#", by Wrox. The Chapell book does
not mention any code that has a class being declared as public, and with no
problems having that class be accessed. The Wrox book says that it is
necessary.
However, my experimentation seems to show that it is not necessary. When I
have this code, I get no compile error, which seems to indicate that there is
no reason to declare it. Also, it seems that it is impossible to declare a
class in anything but public.
And come to think of it, in all my years slamming out C++ code, every class I
composed was declared public. Perhaps the folks at Micro$oft figured to make
it automatic?
I would presume that this is the case for VB.NET. In MC++, it seems to be
impossible to put any visibility (access) qualifier on a __gc class. Is this
accurate?
Thanks
class A { public void f(){}}
public class B { public void g(){}}
class CCC
{
[STAThread]
static void Main(string[] args)
{
A a = new A(); // OK
a.f(); // OK
B b = new B();
b.g();
}
}
..NET" by David Chappell, and "Fast Track C#", by Wrox. The Chapell book does
not mention any code that has a class being declared as public, and with no
problems having that class be accessed. The Wrox book says that it is
necessary.
However, my experimentation seems to show that it is not necessary. When I
have this code, I get no compile error, which seems to indicate that there is
no reason to declare it. Also, it seems that it is impossible to declare a
class in anything but public.
And come to think of it, in all my years slamming out C++ code, every class I
composed was declared public. Perhaps the folks at Micro$oft figured to make
it automatic?
I would presume that this is the case for VB.NET. In MC++, it seems to be
impossible to put any visibility (access) qualifier on a __gc class. Is this
accurate?
Thanks
class A { public void f(){}}
public class B { public void g(){}}
class CCC
{
[STAThread]
static void Main(string[] args)
{
A a = new A(); // OK
a.f(); // OK
B b = new B();
b.g();
}
}