|
I'm just curious...why is it that the number of visual c++ programmers overwhelmed the number of those using Visual Basic/VB.NET and C#, I'm just a newbiew in programming, and looking for a language most suitable for mobile (embedded) development. And in microsoft roadmap for VS.NET whidbey/orca i saw that visual c++ .net will be enhanced for native coding ( i really dont know what this mean and its diff in "manage" offered by .net ). Can anyone help me on this. i'm recently stdying embedded visual C++ 4.0, do you think my knowledge in this PL will be usefull in the future?
|
|
|
|
|
monn wrote:
why is it that the number of visual c++ programmers overwhelmed the number of those using Visual Basic/VB.NET and C#,
How in the world could you possibly gather statistics to support such a claim? If a person has been using VC++ for a number of years, but then starts using VB for a project, how would they go about answering a "What programming language do you use?" poll? Answering VB would mean that all prior work done with VC++ is not considered. Answering VC++ would mean that current work done with VB is not considered. Answering both would effectively cancel each other out.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
God is Real, unless declared Integer.
|
|
|
|
|
It usually helps to put some useful text with a smiley so the recipient does not have to guess as to what is being said/implied.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
"WTF" :no-comments:
God is Real, unless declared Integer.
|
|
|
|
|
monn wrote:
i'm recently stdying embedded visual C++ 4.0, do you think my knowledge in this PL will be usefull in the future?
Maybe, although I am guessing the applications for specifically Visual embedded C++ are limited. There are a ton of applications for C or C++ in an embedded environment, but unlike in the desktop relm, Microsoft does *not* dominate the embedded environment... there are many different platforms out there running embedded systems. It may be running Embedded NT, Linux, or something else...
Your best bet is to learn good overall programming and design practices, and learn whatever specific technologies are needed (or are best) for the particular task in question.
Sometimes I feel like I'm a USB printer in a parallel universe.
|
|
|
|
|
C programmers have been around longer and many (if not most) switched to C++ as a better C (or they had no choise). Visual Basic has not been around as long and is almost usless if someone has not written the controls to interface with in C, C++, Pascal, or some other lower level language first. VB.NET and C# are the new kids on the block and are still MS specific (well VB is too!). If you learn how to program in C/C++ then your skills may be cross platform (more or less). There may in fact be more VB (so called) programmers than C++ programers because the amount of, low level, knowlegde required is less.
INTP
|
|
|
|
|
I wanted to know the coordinate of a child window in relation to a parent window.
To recap my resource script
EDITTEXT IDC_EDIT1,34,50,26,14,ES_AUTOHSCROLL | NOT WS_BORDER<br />
PUSHBUTTON "&Size Info",IDC_SIZE_INFO,69,91,56,26<br />
Someone replied (thanks) saying that i code as follows:
CPoint pt(0,0);
<br />
child->ClientToScreen(&pt);
parent->ScreenToClient(&pt);
My problem is that not getting the correct correct coordinates can anyone explain why it's happening and how to I go about doing it.
Many thanks in advance.
Alton
|
|
|
|
|
To get a client rectangle of a child do the following:
CRect crChild;
pWndChild->GetWindowRect(&crChild);
ScreenToClient(&crChild);
Things to Note:
This is called from the CWnd derived class of the parent.
pWndChild is a pointer to the child window you want the coordinates for.
Ant.
|
|
|
|
|
Coordinates in a resource file are specified in dialog base units, while coordinates used in Windows get/move/size APIs are specified in pixels. GetDialogBaseUnits() is one method you can use to convert between the two.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
class A<br />
{<br />
public:<br />
A() :<br />
i(0)<br />
{<br />
}<br />
int i;<br />
};<br />
<br />
class B : public A<br />
{<br />
public:<br />
void Inc()<br />
{<br />
i++;<br />
}<br />
};<br />
<br />
A *pa = new A;<br />
B *pb = (B *)pa;<br />
pb->Inc();
The pointer is not a type B, but class B has no own
data and if i run it it works.
Is this valid?
What happens when i do that?
/Magnus
- I don't necessarily agree with everything I say
|
|
|
|
|
It is valid
Inc uses i of B inherited from A
When u cast the pointer, pb has all the class info of B, he can find Inc (which is logic ) and can find i, so no problem
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
yes it works, and you're not even obliged to cast into (B*).
the pointer is a base class pointer and it calls the B::Inc() function.
you could do much interresting, with creating another Inc() function into class A...
what happens now? A::Inc() is called. strange ? no. it is a well known consequence of virtual keyword.
when you have many derives classes (as here), and into which many functions have the same name, you'll have to declare virtual (in the base class) the function if you want with such command lines that the B::Inc() is called.
in brief, :
without virtual :
<font style="color:blue;">class </font>A {
<font style="color:blue;">protected</font>:
<font style="color:blue;">int</font> i;
<font style="color:blue;">public</font>:
<font style="color:blue;">void</font> Inc (<font style="color:blue;">void</font>);
};
<font style="color:blue;">class </font>B : <font style="color:blue;">public class</font> A {
<font style="color:blue;">public</font>:
<font style="color:blue;">void</font> Inc (<font style="color:blue;">void</font>);
};
A* pa = <font style="color:blue;">new</font>(B);
pa->Inc(); <font style="color:green;">
with virtual :
<font style="color:blue;">class </font>A {
<font style="color:blue;">protected</font>:
<font style="color:blue;">int</font> i;
<font style="color:blue;">public</font>:
<font style="color:blue;">virtual void</font> Inc (<font style="color:blue;">void</font>);
};
<font style="color:blue;">class </font>B : <font style="color:blue;">public class</font> A {
<font style="color:blue;">public</font>:
<font style="color:blue;">void</font> Inc (<font style="color:blue;">void</font>);
};
A* pa = <font style="color:blue;">new</font>(B);
pa->Inc(); <font style="color:green;">
ps: why do you put your int i; into public statement ?
TOXCCT >>> GEII power
|
|
|
|
|
Yes, i know how virtual baseclasses work, what i was
wondering was about casting to a subclass with no data
from a baseclass.
toxcct wrote:
ps: why do you put your int i; into public statement ?
I did it so a could access it from B and i dont like
the protected keyword..=)
/Magnus
- I don't necessarily agree with everything I say
|
|
|
|
|
|
There are many cases where a member can be public without issue. Look at the CRect class. What would be the point of protecting left, top, right and bottom?
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
why do we protect data members ?
TOXCCT >>> GEII power
|
|
|
|
|
I am not saying you shouldn't, I am saying you don't have to.
This isn't a black/white issue. It isn't about always doing it or never doing it. It is about doing it when it is appropriate.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
I dont really see the point with the protected keyword.
Maybe someone inherits from the class and then it can be modified, either it is publicly modifiable or not, i dont see the point
with have it "maybemodifable".
/Magnus
- I don't necessarily agree with everything I say
|
|
|
|
|
no, a protected member is only modifiable by the derived classes objects (and of course objects from the class itself), and occasionately by friends functions too, but in any case by the outside.
TOXCCT >>> GEII power
|
|
|
|
|
Yes i know how it works i just dont see the point with the protected keyword.
/Magnus
- I don't necessarily agree with everything I say
|
|
|
|
|
_Magnus_ wrote:
i dont see the point
sorry, my english is poor sometimes
what do you mean with this ?
TOXCCT >>> GEII power
|
|
|
|
|
The protected keyword is for people who trust others to properly augment the implementation of a class in a derived class.
In the last three or four weeks I have wasted endless amounts of time because VCL (Borland's MFC) made far too many things private. I couldn't fix the bugs in their code without completely replacing their classes.
If they had made their stuff protected and trusted me, I would have saved a lot of time.
I hardly ever use the private keyword because I trust the programmers not to screw up the implantation. If they do screw things up, I beat them up and then make them fix it. I would rather them do that than have to reimplement my classes in their own stuff creating two implementations of the same theme.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
The protected keyword lets you differentiate between accesses of the value by users of the class from accesses by derived classes. Ordinary users of the class may not access a member marked protected . A derived class, which supplements or modifies the behavior of the base class, is granted privileged access.
Software Zen: delete this;
|
|
|
|
|
What you are doing will work then, but it is really bad code. Sometimes people do what you do when they have no choice and need to access protected and private members in a given class. This is usually do to poor design of the base class. (*cough* BORLAND VCL)
However, what you are doing is very questionable indeed. It looks like a maintenance nightmare.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|