C# vs C++???? whats the difference?

Started by
10 comments, last by Washu 15 years, 1 month ago
Hey, I have posted several times. Many of my posts were crappy noob posts. This one(1) will also be a nooby post. Sorry for the inconvenience. I recently downloaded C++... *woohoo...?* I was wondering should i learn C++? or should i put them into an arena and make them fight to the death... ...I heard C# is appearently easier and more flexable... Is this true? I am just a beginner and i dont wana get into anything to hard. I made a game with flash but a tut helped me out and then my trial expired. --------------------------------- What is DirectX is there any relation to C++/C#?
________________________"One cannot truely live until one has accepted death." - Unknown
Advertisement
Quote:Original post by darkeye98
What is DirectX is there any relation to C++/C#?

Ooh, i've always wanted to do this: Let Me Google That For You. I love that site [grin]

Sorry, i couldn't help myself. Anyway, there are a lot of people who come here asking what language they should get started with and a whole lot of answers, so if you search the forums you should find a lot of answers.
The basic answer, C# (although i have never used it) is easier to pick up than C++ so you are probably better off learning that first. C++ is more powerful in what you can do with it but there will be a lot that you will have to understand before you can even do basic stuff. The two are not that different as far as i know so if you start on C# then you can learn C++ later when you are ready.

Hope that helps.
[Window Detective] - Windows UI spy utility for programmers
I agree with XTAL start with C#, C++ is a lot more complicated. This is what I always tell people learn C# basics and then check out XNA 3.0 and start developing stuff there. When you think you have grasp the concepts of C# programming step into C++ you will need to learn the basic here too, I would suggest getting into it a lot deeper before you start doing OpenGL or DirectX programming.
Quote:Original post by XTAL256
C++ is more powerful in what you can do with it
Hope that helps.


This isn't really true (and I don't just mean turing completeness [wink]). Pretty much all of the language features in C++ can be done in C# in some form or another.

Onto the point, I'd recommend C#. You'll want to learn C++ eventually, especially if you want to get into the industry professionally, but there's no need to rush yourself. C# is much easier to learn, and you can apply the principles you learn there to most other languages.

There's a fair degree of difference between the two languages, but C# is closer to C++ than most others nonetheless. Most game engines are in C++, but I wouldn't suggest messing with them until you learn the basics of DirectX (if you want to go the 3D route).

I won't go into what DirectX is since the above poster pretty much covered it, but it should be noted that DirectX is generally (almost always) done in C++. Certainly, there exist things similar to DirectX (including several wrappers to it) in C#, but if you ever want to use it straight-up, you'll need C++
Quote:Original post by SeraphLance
This isn't really true (and I don't just mean turing completeness [wink]). Pretty much all of the language features in C++ can be done in C# in some form or another.

I thought C# was more like Java in terms of memory management, i.e. pointers, memory allocation, garbage collection.

Also, when the OP does start to learn a graphics API i personally think OpenGL is easy to learn. Again, i can't make any comparisons because i have never actually used DirectX, but i OGL is pretty easy to setup if you look at any good tutorial and you can go from there. I learnt OpenGL almost my accident when i found a sample project in the DevC++ IDE.
[Window Detective] - Windows UI spy utility for programmers
Quote:Original post by XTAL256
Also, when the OP does start to learn a graphics API i personally think OpenGL is easy to learn. Again, i can't make any comparisons because i have never actually used DirectX, but i OGL is pretty easy to setup if you look at any good tutorial and you can go from there. I learnt OpenGL almost my accident when i found a sample project in the DevC++ IDE.


Agreed. When i was first starting, I looked into both OpenGL and DirectX. I found OpenGL to be much easier to set up (using GLUT), and it was very easy to learn and work with. DirectX scared me off with all of its cryptic types (LRESULT, HDC, etc.), though I think I'd appreciate it much more these days.

I'm not sure which I'd recommend, C++ or C# to start with. Probably C# because it's much easier to use (in my opinion), and a much nicer language, though I think it'd be easier to go from C++ to C# than vice versa. Either way I think you're fine.
Without order nothing can exist - without chaos nothing can evolve.
Quote:Original post by darkeye98
Hey, I have posted several times. Many of my posts were crappy noob posts. This one(1) will also be a nooby post. Sorry for the inconvenience.


That's what For Beginners is for.

To address the question as asked in the subject line, they are pretty much entirely unrelated languages. You will almost certainly have an easier time with C#, but there are still easier-to-use options out there that will still let you accomplish quite a bit. In fact, that ease of use means that you will probably end up accomplishing more. :)

Knowing either C++ or C# first will help somewhat with learning the other, but the same is true of many programming languages. They are fairly similar as languages go, but it's worth the effort to learn several widely different languages. That's in the long term, though. For now, just try a few things and stick with what you like.

Quote:I made a game with flash but a tut helped me out and then my trial expired.


That's the problem with trials, hmm? :) Fortunately, there are plenty of Flash-like environments out there. Some of them are "integrated" like Flash; others are designed to have you program in a specific, existing language and just make it easier to make a game with that language. Example.

Quote:What is DirectX is there any relation to C++/C#?


Something that, as a beginner, you don't really need to worry about.

Quote:Original post by XTAL256
I thought C# was more like Java in terms of memory management, i.e. pointers, memory allocation, garbage collection.


Well, yes, but all of that has nothing todo with the 'power' of the language what so ever.
C++ is tough! but it is better than C# in the case of memory management! We dont have control of memory management in C#! A little understanding of C++ can solve most of the toughest problems! so in my opinion it is worhtwhile to invest your time in C++ than in C#!
Quote:Original post by phantom
Well, yes, but all of that has nothing todo with the 'power' of the language what so ever.

Ok, i guess 'power' probably wasn't the correct term.

@praju1985: yes, it probably is worhtwhile learning C++ eventually. But it would be too much for a beginner to learn. I started on Java 1st year at uni and learned C/C++ in second year. If you have absolutely no prior programming knowledge and you want to get into programming without going through years of theory then something like Java or C# is definitely better than C++. I know some people that started programming BASIC as soon as they were born and they say it's better to learn the low-level stuff first. Then, once you have a clear understanding of how a computer works then you can start on assembly and work your way up. But with modern 3rd and 4th generation languages this is not necessary, it's quite ok to start with an easy language and then go deeper into machine specific stuff later. In fact, it's probably not even necessary to know anything about how a computer works internally and still make some decent programs/games.
[Window Detective] - Windows UI spy utility for programmers

This topic is closed to new replies.

Advertisement