|
You can't. It's only in VS2005. Yuo can write your own, it's kind of trivial to do so.
And, this is not a managed C++/CLI question.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Christian Graus wrote: You can't. It's only in VS2005.
Hey CG,
While I am not 100% sure, I believe the sceure CRT was introduced in VC 2003, except that it didn't raise the warnings.
|
|
|
|
|
Yes, VS2003 had Strsafe functions! The replacement for strcpy was StringCbCopy for example. In order to use the Strsafe functions you had to do he following:
#define STRSAFE_LIB
#include <strsafe.h>
After doing the above, the compiler will view the older functions as deprecated, and the compilation will terminate with errors.
Geo
|
|
|
|
|
what are the base class variables can be accessible in below 3 derived classes ?
class base
{
public int i;
private int j;
protected int k;
}
class deriv1:public base
{
}
class deriv2:private base
{
}
class deriv3:protected base
{
}
-- modified at 8:10 Monday 6th November, 2006
Govindarajan,B.
|
|
|
|
|
Yes they are accessible,
in the first case
deriv1 class gets i,j,k in its public region.
in the second case
i,j,k become private in class deriv2
in the third case i,j,k become protected in class deriv3
but a class can access its variables, so all the three variables are accessible in all the three classes.
regards
Prashant Sabnekar
Regards
S.Prashant Sabnekar
|
|
|
|
|
Hi,
Thanks for your answer .
I have modified the varible's access specifier in base class now.
Before I forgot it.
I want the solution with this modification.
Thanks.
Govindarajan,B.
|
|
|
|
|
Do not listen to Prashant he doesn't know that he is talking about. Use the compiler to figure out the answers for your self.
led mike
|
|
|
|
|
Hi Mike,
The question is changed.
Earlier he kept everything public(i,j,k) so I said these are going to be public,
now he changed them to public, protected, & private.
My comment was actually to the previous question.
Prashant Sabnekar
Regards
S.Prashant Sabnekar
|
|
|
|
|
Prashant Sabnekar wrote: The question is changed.
Ah, well yeah that makes a difference.
led mike
|
|
|
|
|
Prashant Sabnekar wrote: deriv1 class gets i,j,k in its public region.
No, that is wrong.
Prashant Sabnekar wrote: so all the three variables are accessible in all the three classes.
Wrong again.
led mike
|
|
|
|
|
|
Hi Govindrajan,
First of all I want to say everybody that you have changed your question.
earlier you kept everything in public, now you have changed them.
Your solution is :
class deriv1 inherits variables i & k from class base.
i becomes public in class deriv1
k becomes protected in class deriv1
class deriv2 inherits variables i & k from class base.
i becomes private in class deriv2
k becomes private in class deriv2
class deriv3 inherits variables i & k from class base.
i becomes protected in class deriv3
k becomes protected in class deriv3
Regards
Prashant Sabnekar
Regards
S.Prashant Sabnekar
|
|
|
|
|
Actually, this is all mute since this is the C++/CLI forum, and C++/CLI only supports public inheritance.
|
|
|
|
|
Hi to all,
I want to stop a console application programatically in C++ by not using TerminateProcess function. For window applications, I send WM_CLOSE message to the application to stop the process but I could not find a way to do it in a similar way for console appliactions.
Do you have any suggestions?
ebru dogan
|
|
|
|
|
Does it have a message loop? If so, you could try a WM_QUIT message.
|
|
|
|
|
I used the Visual C++ wizard to create a Windows Forms Application and the namespace for the main form in the project header file defaulted to the project name. I'd like to change the namespace to match that of some unmanged code I have, but any time I modify the namespace, the Windows Forms Designer cannot parse the header file. Since the namespace I'd like to use is not a top-level namespace (it has :: in it), creating a new project with the namespace I want is not an option. I am currently using .NET 2003 but will soon be upgrading to 2005, so a solution in either environment would be much appreciated.
Thanks!
-alex
|
|
|
|
|
:: scopes namespaces in C++, but not in .NET. I suspect you need to replace the :: with nested namespaces, as that's what they are.
I am not sure if managed and unmananged code can share a namespace name.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I was silly. The easiest way to fix this is just to define a namespace alias in the header file before the automatically generated code.
|
|
|
|
|
FYI, this only works in VC++ .NET 2003. In 2005, it generates a C2757 error saying a symbol with the namespace name already exists so it can't be used. Personally, I think the error is bogus, but I'm no C++ expert.
nofun wrote: Forum(Managed) C++/CLI
Subject:Re: Changing the namespace in a Windows Forms Application
Sender:nofun
Date:21:17 6 Nov '06
I was silly. The easiest way to fix this is just to define a namespace alias in the header file before the automatically generated code.
|
|
|
|
|
Turns out VC++ 2005 is correct according to the C++ specification. http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=135955&SiteID=1[^] In VC++ 2005, you can directly change the namespace name, including nesting namespaces, and the Windows Forms Designer will still manage to parse the file. Me jump to conclusions, but MSFT is right on this one.
|
|
|
|
|
string strd1 = "9";
int m=atoi(strd);
Got the error: error C2664: 'atoi' : cannot convert parameter 1 from 'class std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >' to 'const char *'
how to change the second line to make it work?
|
|
|
|
|
This is the correct way:
string strd1 = "9";
int m = atoi(strd1.c_str());
|
|
|
|
|
I have the same problem long time ago. It is a mix mode of string vs char. Here the solution:
define string strd1 = "9"; as char strd1 [1]="9"; or CString strd1 ="9";
|
|
|
|
|
Multi-dimensional BST is a BST with multi-dimensional keys.
In a k-dimensional BST, each node has a k-dimensional data and the tree indexes dimension i of the data at level i. For a node at level i, its discriminator, disc = i % k, that is, kdisc is used to discriminate its descendants.
Example For a 3-d BST, each node is a vector of 3 keys, < k0, k1, k2 >.
For a node at level i, its discriminator, disc = i % 3, kdisc is used to discriminate its descendants.
Similar to BST, we can perform the basic operations such as Insert, Search and Delete. For the first two operations, only a little extra checking has to done when traversing the tree. As for deletion, it is a bit complicated to find the successor / predecessor of the node to be deleted.
Do any one know how to implement?
|
|
|
|
|
graceyuki wrote: Multi-dimensional BST is a BST with multi-dimensional keys.
Is that supposed to be informative?
led mike
|
|
|
|