views:

336

answers:

3

I am using classes from a dll in my c++ project. All is working fine, until...

When trying to call a certain method (listed in the object browser), I am getting an error that this method is not a member of the namespace.

Upon invastigation, I noticed that this method is listed as "virtual void x() sealed".

Is there a way to make a call to such a function?

TIA

+1  A: 

I don't see why it being virtual and sealed should in itself prevent you from calling the function. According to MSDN, the sealed keyword is specifically meant for virtual methods anyway.

Is there any more information you can give about the function in question and how you are trying to use it?

Tim Yates
I am referring to the Dispose function of the LogWriter class in Microsoft Enterprise Library's Logging block. All other methods and properties of the class work without a problem, and the only differences I saw in this one, is the above mentioned. I tried to use it like: 'writer->Dispose();', and I'm getting an error that the method is not a member of Microsoft::Practices::EnterpriseLibrary::Logging::LogWriter. Thanks a lot
+1  A: 

Sealed in a C++ CLI keyword (managed C++) specific to .NET and not C++ in general.

sealed on a function means that you can't override that method in a derived type.

sealed does not mean that you can't call the function, I'm guessing your function is private.

Brian R. Bondy
+2  A: 

For future reference, I just received a response from the enterprise library support team. They posted a link to the following:

Managed C++ and IDisposable I'm writing some code using the new Managed C++/CLI syntax and I ran into this error:

error C2039: 'Dispose' : is not a member of 'System::IDisposable'

the code I started with was this:

image->Dispose(); // image implements IDisposable

which gave me the same compiler error, so I wanted to eliminate a class/namespace error so I rewrote it as this:

((IDisposable ^)image)->Dispose();

Which gave the above error. Yikes!

Here's the fix:

use delete. Managed C++ now hides Dispose() inside the finalizer. Just delete the object, it handles the rest. Freaky.

This really works!!!!

Note you can format code as code by prepending four spaces (additional spaces are preserved as indentation); the "101\n010" button in the editor toolbar will do this for you. Congratulations on finding the answer.
outis