|
Hi all,
What is the use of declaring a private destructor?
Where we are using this? Can anybody tell an example
Thanks
San
|
|
|
|
|
The purpose of the private destructor is to avoid the deletion of the object while it is still referenced
Some things seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Could please send me some sample code
|
|
|
|
|
and other use could be if you want to stop the creation of the object on stack. Yes, you can not delete these object by using delete. Either you have to assume that you don't want to delete such objects or you have to overload the delete or delete these from any friend function.
class Test
{
public:
Test(){}
private:
~Test(){}
};
int _tmain(int argc, _TCHAR* argv[])
{
//Test tmp; // Compilation error;
Test *testP = new Test(); // work fine
return 0;
}
Manish Agarwal
manish.k.agarwal @ gmail DOT com
|
|
|
|
|
Test *testP = new Test();
what about delete?
|
|
|
|
|
for delete we have to create a friend function or we have to assume that we don't want to delete this
Manish Agarwal
manish.k.agarwal @ gmail DOT com
|
|
|
|
|
HI Manish,
How to write Friend Function to call Delete on Private Destructor.
Thanks,
Krishna.
|
|
|
|
|
here is a minimal example
class A
{
private:
~A(){};
public:
A(){};
friend void fn();
};
void fn()
{
A a;
}
In this case if you create a object of class A on stack in any other function other than fn() complier will give you an error C2248: 'A::~A ' : cannot access private member declared in class 'A '
Manish Agarwal
manish.k.agarwal @ gmail DOT com
|
|
|
|
|
Hi,
i am currently develop the CSP for Windows Vista platform.
i find out from internet that i need to replace advapi32.dll file in the system32. i already changed it and managed to replace the dll.
but, i still get an error when i run in the cmd prompt:
c:\windows\system32\regsvr32 mimoscsp.dll
the error that i got was :
the module "mimoscsp.dll" was loaded but the call to DllRegisterServer failed with error code 0x8009006
when i try to run the test program, i got an error at the function:
CryptAcquireContext returned error-57
anyone knows about it?
thanks
|
|
|
|
|
Error code 0x80090006 means "Invalid Signature"
Did you forget to sign the dll?
Test Signing the CSP[^]
Best Wishes,
-David Delaune
|
|
|
|
|
Hi David,
Thank you for the reply.
My question:
Do i need to sign it first? Coz I'm not finalize the code yet. As what I understand, in XP, i just need to replace the advapi32.dll to the c:\Windows\system32 directory. (the advapi32.dll for win XP).
i did the same for vista.. i change the offset value (refer to the website) and reboot the computer. But i still get the same error.
am i doing the wrong thing here?
|
|
|
|
|
izyani wrote: Do i need to sign it first?
There are several unsupported methods of modifying advapi32.dll floating around the internet, some of which allow self-signed CSP and others allow unsigned CSP. I have no way of knowing what modifications you have made to the system DLL. The error code your recieving 0x80090006 implies that advapi32.dll is checking the signature.
|
|
|
|
|
Hi Randor,
FYI, I already changed the advapi32.dll with this value:
* Windows 2008 and Windows Vista SP1 : advapi32 version = 6.0.6001.18000
o At offset 0x2420C : change 75 to 90
o At offset 0x2420D : change 0C to 90
o At offset 0x24214 : change 0F to 90
o At offset 0x24215 : change 84 to E9
Refer to the instruction, i need to replace the file at:
a)C:\windows\system32
b)C:\Windows\winsxs\x86_microsoft-windows-advapi32_31bf3856ad364e35_
6.0.6001.18000_none_e34851aa8681b8b0
c)rename the patched advapi32.dll file to x86_microsoft-windows-advapi32_31bf3856ad364e35_
6.0.6001.18000_none_e34851aa8681b8b0
_advapi32.dll_9512793c and then put it in "C:\Windows\winsxs\Backup", thus overwriting the existing one.
I already restart and my machine after replaced the file. I tried to run the cmd :
c:\windows\system32\regsvr32 mimoscsp.dll and
c:\windows\system32\regsvr32.exe mimoscsp.dll
but i still get the same error - the module "mimoscsp.dll" was loaded but the call to DllRegisterServer failed with error code 0x8009006.
|
|
|
|
|
Hi,
During the development, I already run the cmd:
c:\windows\system32\cspSign c xxxx.dll
c:\windows\system32\regsvr32 xxxx.dll
success..
when i run the test program, i got this error msg:
Calling CryptAcquireContext - CryptAcquireContext returned error 57
Calling CryptGetUserKey AT_KEYEXCHANGE - ERROR_INVALID_PARAMETER.
Calling CryptGetUserKey AT_SIGNATURE - ERROR_INVALID_PARAMETER.
Done
|
|
|
|
|
i wish to find a program source code for the following fft ,dft, idft
and linear and circular convulution. please if anyone can help me out.
kamal jit sharma
|
|
|
|
|
Whenever I'm after some code that implements a particular algorithm, I typically find myself performing searches for the code I want. It is my most common experience that just asking a question on a forum takes longer than it takes to find the code. When you also allow time for the response to your forum question, it is orders of magnitude slower to ask on a forum than it is to search for code yourself.
And yes, I have done just this for some of the algorithms you mention.
Good luck.
Simon
|
|
|
|
|
Do you know about Google? Shhhhhhhhhhh it's a secret.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I have an example of for loop like
for( int I = 0; I < 100; i++)
{
If (condition)
{
Method1. Write ‘break’ here or
Method2. I = 100 (make I equal to 100)
}
}
Which method is efficient to use? Why?
Thanx
|
|
|
|
|
Imho break is more efficient because using break will just jump out of the loop while setting the variable 'I' to a value has to perform memory read/write operations, then it will jump to the condition-evaluation part, where it will check the variable against 100 and will then jump out of the loop. Am not sure how smart the compiler is but it might even optimize the later case to a simple break or "value-set" then break itself.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
I would use a control variable.
I strongly advise not to set the loop variable, 'I' in your case, to a bogus value just to exit the loop because you might want to use the variable after the loop.
Something like this:
bool bStop = false;
int nCount;
for( nCount = 0; (nCount < 100) && !bStop; ++nCount )
{
if( condition )
{
bSstop = true;
}
}
if( nCount < 100 )
{
}
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Either one is fine. I prefer to go the break; route.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
The break keyword was designed just for this.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
i use the break key word in my virii like so...
if(DeployCondition)
break ThatGuysPC->HDD;
|
|
|
|
|
killabyte wrote: virii
Should be viruses (even if my ancestors didn't foresee such a proliferation of).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I do agree with cPallini.
Use break for your condition.
|
|
|
|