|
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
|
|
|
|
|
if I have three words in there lines in a .txt file, and I want to read them to three string, how to do this using c++ ifstream? how to read every line(word)?
|
|
|
|
|
Use getline.
And, next time, ask in the right forum This is the C++/CLI forum.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I am using C++ in VC++ 2003
there are some examples like this http://www.codeproject.com/cpp/miniexcel.asp
but I don't quite understand.
I hope someone could help me or guide me to some related documents, bow!
|
|
|
|
|
bloodwinner wrote: http://www.codeproject.com/cpp/miniexcel.asp
That article is not really "about" Excel Automation. You need to research the Microsoft Office Object Model specifically the Excel Object Model. The MSDN site has examples and of course the documentation to these COM interfaces.
If you posted this in the correct forum it means you are using the .NET runtime for your project. In that case you can use the Microsoft supplied .NET libraries. http://support.microsoft.com/kb/302084[^]
led mike
|
|
|
|
|
Write a program that takes an infix expression and converts it into prefix expression using stacks and c++ code.
|
|
|
|
|
Sounds like you have a good professor, good luck your assignment.
led mike
|
|
|
|
|
led mike wrote: Sounds like you have a good professor, good luck your assignment.
Same thought here since the OP reeks like homework
|
|
|
|
|
I am using the MFC dialog application.
There are 3 edit box, add1, add2 and sum
and a button "add",
when exectuing, I input add1, add2, and use the "add" function dlg.m_sum=dlg.m_add1+dlg.m_add2
how to make the sum appears in the "sum" edit box? Do I have to add a view class or how to modify the OnPaint?
I now only have add.cpp and addDlg.cpp
|
|
|
|
|
bloodwinner wrote: I am using the MFC dialog application.
Then you're not using C++/CLI, are you ?
bloodwinner wrote: dlg.m_sum=dlg.m_add1+dlg.m_add2
I assume you have associated ints with the text boxes, not edit controls ?
Then you need to call UpdateData before you do the calculation, to bring down the variables, and UpdateData(FALSE) after the calculation, to populate the controls again. Or, maybe the other way around.
Please ask in the right forum next time
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|