Discrepancy in default inheritance specifier in C++ and MC++ 
Author Message
 Discrepancy in default inheritance specifier in C++ and MC++

I have the following classes in C++ and MC++:

__abstract class Abstract
{
public:
  Abstract()
  {
    cout << "Abstract()" << endl;
  }

Quote:
};

class Concrete : public Abstract
{
public:
  Concrete()
  {
    cout << "Concrete()" << endl;
  }

Quote:
};

__abstract __gc class AbstractAndManaged
{
public:
  AbstractAndManaged()
  {
    Console::WriteLine(S"AbstractAndManaged()");
  }

Quote:
};

__gc class  ConcreteAndManaged : [public]
AbstractAndManaged
{
public:
  ConcreteAndManaged()
  {
    Console::WriteLine(S"ConcreteAndManaged()");
  }

Quote:
};

If I dare taking out the public specifier in
ConcreteAndManaged:

__gc class ConcreteAndManaged : AbstractAndManaged {...}

I'm punished with:

error C3628: 'ConcreteAndManaged': managed classes only
support public inheritance

Why the discrepancy?  It would seem to me that the
default inheritance specifier should be public, just like
in C++.

Any takers?

Regards,

Javier



Sun, 24 Jul 2005 13:24:39 GMT  
 Discrepancy in default inheritance specifier in C++ and MC++

Quote:
> If I dare taking out the public specifier in
> ConcreteAndManaged:

> __gc class ConcreteAndManaged : AbstractAndManaged {...}

> I'm punished with:

> error C3628: 'ConcreteAndManaged': managed classes only
> support public inheritance

> Why the discrepancy?  It would seem to me that the
> default inheritance specifier should be public, just like
> in C++.

> Any takers?

You are not being punished.

The default inheritance for a class is public. It is private for structs.



Mon, 25 Jul 2005 06:34:40 GMT  
 Discrepancy in default inheritance specifier in C++ and MC++

Quote:

> You are not being punished.

> The default inheritance for a class is public. It is private for
> structs.

Other way around - private default for class, public default for struct.

-cd



Mon, 25 Jul 2005 06:56:03 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Is there a crypt() function for either MC C/C++ or Borland C/C++

2. Default inheritance of file handles

3. Managed C++ and Unmanaged C++ and Inheritance

4. Visual form inheritance from base form implemented in C++ with Managed Extensions (migrated from unmanaged C++)

5. mc++ causes designer problems

6. Is const for value references obsolete in mc++?

7. Any chance making ConditionalAttribute work with mc++

8. ngen:ed mc++ dll stops working!

9. mc++ causes designer problems

10. Security for mc++ apps

11. finding app path in mc++ application ?

12. is there 'intsanceof' equivalent in mc++

 

 
Powered by phpBB® Forum Software