|
Since you've chosen to implement a copy assignment ctor, you really have to do it properly. It's a ctor and it's up to you to choose how to initialize bases and members, just as with the default ctor. When you implement a copy assignment ctor, it's your responsibility to initialize everything correctly. If you don't provide specific initialization for bases or members, their default ctors are used for initialization.
If you don't implement a copy assignment ctor, the compiler will generate one that makes binary copies of PODs and calls copy assignment ctors where such are available.
--
The Blog: Bits and Pieces
-- modified at 2:29 Thursday 20th October, 2005
|
|
|
|
|
Johann Gerell wrote: If you don't provide specific initialization for bases or members, their default ctors are used for initialization.
This sentence is helpful for me to understand, thanks!
Johann Gerell wrote: PODs
|
|
|
|
|
Hi
I currently use an implementation of the GoF observer pattern in C++. i.e. my observing class connects to a subject and then receives updates when it changes state. Having now waded into the Managed C++ arena I find the need to propagate the update call up into Managed C++ world from Unmanaged. My observers inherit from a class much like this:
class Observer
{
public:
virtual void Update(void) = 0;
}
I would love to be able to do the following:
__gc class MyObserver : public Observer
{
...
}
problem solved, but no, __gc classes cannot inherit from __nogc classes. I would like to find an approach which mimicks my existing technique as closely as possible.
Thanks
|
|
|
|
|
You might read this information from MSDN:
Interoperation with Unmanaged Code[^]
Also, here's more:
Interoperability in Managed Extensions for C++[^]
Interop is a complex subject. It kind of depends on what exactly you want to Interop with. Is this a compiled DLL? A COM type library? Or, just a bunch of text source code? Most importantly are the data types compatible?
If it was me, I'd just rewrite everything in .NET framework.
|
|
|
|
|
I'd like to write a command line program that expands command-line arguments just like typical DOS commands, like dir/ren/copy etc.
For example, if I typed "myprog *.doc" my program would get as its arguments the filenames of all doc files in the current directory.
I suppose I could write my own code to do this, but it seemed pretty standard and I was surprised to not find other code that does this.
-Ben
|
|
|
|
|
I think there's an API which takes that string and returns all the files to match.
If not, there's always this[^].
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi,
I know there is an Internet&Networking category, but most of the articles there are for Windows.
Can someone guide me, or tell me a book, on Internet(Server/Client architecture) programming which is independent of the OS is running on?
Thanx!
|
|
|
|
|
sir,
i am confused about virtual functions, what is neccessity of virtual function.in which conditions we make fuctions as virtual .plz tell me about virtual functions
|
|
|
|
|
This question has already been answered here[^]
|
|
|
|
|
sorry I am not good know english.
Hey All friends please Help me.
how write voice Server and client. and client is not one. I am used several client. if All client online I am Look in server.
knowledge -> friends -> Good Team
|
|
|
|
|
read some books
go to school
|
|
|
|
|
horIter[i]->ver !=NULL;
i get this syntax error
250 H:\Dev_Cpp\project\Comp125\ass3\SparseMatrix.cpp base operand of `->' has non-pointer type ` listNode'
what i do to inlcude i via the for loop
|
|
|
|
|
We have absolutely no idea what horIter is, neither which for loop you are talking about !
Now, look at the error message and it should tell you the answer. I suppose you have to change the line to
horIter[i].ver != NULL;
|
|
|
|
|
You should dereference an iterator and use it from there, you should not assume that an iterator is a pointer. VC6 will let you do this, VC7 ( correctly ) will not.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Can someone please help me resolve this question because it is driving me mad. i have been working on it for days and still have nothing.
The question is:
To find value of the sum S for which formula composed. Summation (The act or process of adding) to continue until next composed |a[i]|> E.Ispolzovat a heading file and indexes on function for calculation composed under the formula and indexes on a variable.
I know i have to create a formul but i can't see how if some can help please do beacuse i been working on this for 2 weeks, so please please help.
please help
Jannet
|
|
|
|
|
Your question is hard to understand. Please try to explain it a little better.
|
|
|
|
|
Ask your tutor. That way, he/she will know where you are stuck, and perhaps be able to tailor the lessons so that you can follow them.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
int array[] = {9, 8, 5, 4, 1, 4, 2, 8, 7, 8};<br />
int sum = 0;<br />
int n = sizeof(array)/sizeof(array[0]);<br />
for (i = 0; i < n; ++i)<br />
{<br />
sum += abs(array[i]);<br />
}
that should get you started.
read some books, ask your teacher or teacher's assistant for help. go to the computer lab. find a computer club on campus.
|
|
|
|
|
Thanks for your reply. The example you have posted is great. I think im kind of getting the hang of it.
Thanks very much for your help ahz.
|
|
|
|
|
I have an old library that exports a very nice native C++ object model. Its used in a lot of places that won't allow me to switch this to a managed model. However, we're writing a new GUI that we would like to display the information in a .NET grid. So, we need to somehow wrap this in a datasource. Is there an easier way to do this than write a full managed object model wrapper (i.e. just a simple DataSource wrapper that translates between the two)? I'm looking for examples but not finding any.
|
|
|
|
|
I am looking for C++ Software Engineers who may be interested in or have experience working with Radar. If you are interested and live not too far away from Cypress, CA, I would appreciate if you would respond and include your contact information for me to give you a call or e-mail you. I am not a headhunter. The basic requirements are below.
BSEE/BS/Computer Science
RADAR-- Experience in this area is very much desired but if you have the skills and experience and would be excited about working in this arena we are willing to work with you.
Experience in C++ (3-5 years)
WindRiver "Tornado" a plus
VxWorks desired.
GUI
Familiar with DSP
Laura
|
|
|
|
|
You can contact Laura at lalunelamer@aol.com
|
|
|
|
|
I am doing some responsive UI stuff in my program, and my (ThreadPool) thread needs some information from the UI, so it has to call Control::Invoke to get the main UI thread to do some querying... This method passes back some status information through the return value, and I can get the ThreadPool thread to do various actions based on the state... My problem is, sometimes I need more than one piece of information, and would like to pass this additional information out through pointer parameters of the method... Now, the Control::Invoke method has the signature (the one of importance to me):
public: virtual Object* Invoke(Delegate*, Object[]);
So I have to stick the parameters for the method to be invoked into an Object[], which means boxing value types... However, for the pointer arguments (where I expect to get further information passed back out), this is where I'm having problems... I can't use the pointer directly, and I can't box it... I tried using the System::Reflection::Pointer::Box() method, but then I couldn't use the pointer as expected in the method... Maybe I was doing something wrong, but I would unbox it, then manipulate it... Do I need to box it back up before the function terminates, then unbox it again after the Control::Invoke call to get the value stored there...??? Am I missing something...??? Is there another way to do it, or is this a lost cause??? Any help would be greatly appreciated!!! Below is a pseudocode summary of my problem... Thanks...
- istrasci
<br />
On ThreadPool thread:<br />
{<br />
...<br />
System::Int32 status;<br />
int *val;<br />
args[0] = __box(some_val); ...<br />
args[3] =
<br />
status = *dynamic_cast<System::Int32*><br />
(Invoke(myDelegate, args));<br />
...<br />
}<br />
<br />
On main UI thread:<br />
System::Int32 method(int a, int b, int c, int *d)<br />
{<br />
*d = int3;<br />
<br />
return <status info>;<br />
}
|
|
|
|
|
Sorry, this part should have said (it wouldn't let me edit post for some reason)
<br />
|
|
|
|
|
Hi everyone!
I used AfxGetApp()->LoadCursor() to load cursors from resource. It worked well when I build project using 'Use MFC in a Static Library'.
But when I build it using 'Use MFC in a Shared DLL' - LoadCursor() returnes NULL and GetLastError() returnes ERROR_RESOURCE_TYPE_NOT_FOUND .
But LoadCursor(hInstance, MAKEINTRESOURCE(...)) works as well.
What it can be?
Something similar are happen with menues. CMenu::LoadMenu(...) became unsuccess.
Thanks for help.
-- modified at 14:54 Monday 17th October, 2005
|
|
|
|