13

I've done my C++ classes and practices after which I started learning Visual C++ using book Ivor Horton's Visual C++. The problem is that I am unable to understand the language of this book and badly trying to understand the codes. I want to learn Visual C++ for Windows application development and making my future in that (also because I already know C++).

Some of my friends told me to switch to C# since it has many library function to create GUI etc and told me it's hard to code Windows applications in Visual C++.

Now in these holidays I am going to join classes, can you help me which language I should stick to, and which one will be easy?

From very beginning I want to learn Visual C++ and sometimes I think it's hard when I don't understand concept in reference books etc.

Any help will be very appreciated, thanks a lot for taking your precious time.

Community
  • 1
  • 1
M3taSpl0it
  • 2,967
  • 6
  • 28
  • 27

8 Answers8

46

Visual C++ and Visual C# are not languages nor GUI frameworks; they are Integrated Development Environments - IDEs. This means they are text editors tailored to the task of development.

Visual C++ lets you code in C++, Visual C# lets you code in C#. Also, both let you create GUIs in a point-and-click manner.

Sounds like what you really want to do is create GUIs. In that case, without having further information, I recommend you go for C#. It is a much cleaner language than C++, it has fewer ways to shoot yourself in the foot, and it provides access to the immensely useful .NET framework.

C# features that C++ doesn't have:

  • Fully automatic memory management
  • Lambda functions¹
  • Type inference¹
  • Reflection
  • Remoting
  • Automatic serialization
  • True entity types
  • Properties
  • Database integration via LINQ
  • Convenient functional-style programming via LINQ
  • No header files
  • No undefined behavior
  • Direct interoperability with many languages
  • Compile once, run everywhere

¹ these features have been added to C++ in the C++11 standard.

C++ features that C# doesn't have

  • Template metaprogramming
  • Typedefs
  • Zero-overhead principle
  • Means to enforce const-correctness
  • Mature compilers that produce extremely optimized code nowadays
  • Much wider platform support
Community
  • 1
  • 1
Stefan Monov
  • 11,332
  • 10
  • 63
  • 120
  • 4
    For the last paragraph, you're missing the most important feature of C++ (wrt. C#): *deterministic memory management*. – Alexandre C. Jul 07 '11 at 14:41
  • 4
    I'd like to see this answer updated. C++11 has lambda functions and type inference. – Ricky65 Sep 24 '11 at 14:01
  • I have been using C# for while, what is automatic serialization in C#? C# programmers use libraries (.NET or not) to manage serialization. Cant the same done with C++ too? :o – nawfal Oct 21 '15 at 02:20
  • @nawfal: In C# the serialization libraries use usually reflection to figure out what data is contained in a given object graph. That's what I mean by automatic. You don't need to explicitly tell the serializer what data members are contained in your objects, but with C++ you do (even with libraries), as it doesn't have reflection. – Stefan Monov Oct 21 '15 at 12:26
  • @StefanMonov I see that but I had two problems with that. 1) 'Automatic' implies a language feature, at least for me. C# doesn't have any construct to do serialization, rather it is the library around it. May be a better choice of words would help here, like "C# helps serialization", or "It's easier to serialize in C#". 2) In any case, it is covered in the reflection part. It is the reflection which helps it in C#'s case. So may be it is better to be a sub point. Can I edit? – nawfal Oct 28 '15 at 00:11
  • Visual C++ was an IDE, not anymore. Also, a comparison should be made side-by-side, unlike it is made now. – Manohar Reddy Poreddy Sep 18 '18 at 03:05
7

can you help me which language i should stick to , and which one will be easy.

In general, if you're goal is to develop Windows Applications, you'll probably find many, many more simple examples to learn from in C# than in C++. There is a huge community around C# for Windows GUI development.

That being said, many of the concepts you'll need are the same in any language you learn. You can't really go wrong - at some point, you'll probably want to learn both langauges if you're going to program professionally (as well as others).

i think it's hard when i don't understand concept in ref books etc.

You should get a beginning programming book, not reference books, and go through it step-by-step. If your goal is just GUI development, I'd recommend a good, simple C# book, and just step through it form beginning to end, and do all of the examples. Learning from a "reference" book won't work - it's reference material, and not meant to teach concepts.

Reed Copsey
  • 554,122
  • 78
  • 1,158
  • 1,373
4

C++ vs. C# - a Checklist from a C++ Programmers Point of View http://www.thinkingparallel.com/2007/03/06/c-vs-c-a-checklist-from-a-c-programmers-point-of-view/

Robert Harvey
  • 178,213
  • 47
  • 333
  • 501
4

C# is the premeir .net language for developing applications on the .net framework.

Native C++ is more cross platform and low level. It's used for writing applications for windows, mac, linux, embedded systems, etc.

C++.net is C++ adapted to the .net platform, and is primarily used for writing performance critical parts of an application (the rest of which is written in C#, VB.net, or something else as they integrate virtually seamlessly).

Visual C++ is microsoft's windows compiler for C++ that can be used to write native and C++.net applications.

Writing .net applications solely in C++ in much harder than writing them in C# as you have to deal with more low level issues. If you want to write .net applications, I recommend using C# and C++.net if you need it.

Gordon Gustafson
  • 40,133
  • 25
  • 115
  • 157
  • 4
    There is no "C++.net", you mean **C++/CLR**. Also, writing in C++/CLR is hard, but not because it's lower-level (it's not). It's hard because the language uses C++'s old-school syntax with all the gotchas, while C# is designed from the ground up to fit with the .NET framework and to learn from C++'s mistakes. – Stefan Monov Dec 30 '09 at 20:13
4

with C++, you could be able to touch the 'low level' near 'assembly things' part of programming

c# is never meant to be created to beat c++, with c# you get the whole .net framework utilities, faster cleaner form generations, with the lack of 'low level' part

jimmy
  • 41
  • 1
2

C# is largely intended for Business Applications so as Java. Visual C# is Microsoft's implementation of the C# programming language specification, included in the Microsoft Visual Studio suite of products.

C# is much slower than C++, since the code passes through CLR. VC++.net has the same drawback.

VC++ is very hard to learn, so as MFC and windows programming, even though you know C++. But is it a prestigious and efficient language.

It is easy to switch from VC++ to VC#. But the reverse is harder.

If you go for VC++, MFC and Windows programming, try this.

user366312
  • 16,949
  • 65
  • 235
  • 452
1

Maybe consider what you are likely to want to do in the future, as a professional or a hobbyist. Programming is a wide field, in which both languages have their place. If its too early for you to make that decision, C# is probably most likely to do you good in the future.

It's worth remembering that they are both only languages - and just as writing a good book is about more than correct spelling & grammar, writing good code is about more than the details of a particular languages syntax.

0

I would learn both.

Having said that, I would create GUI/Application projects using C#, and use VC++ for any COM or device communication.

I would check out Which platform should I use : native C++ or C# ?

Community
  • 1
  • 1
SwDevMan81
  • 48,814
  • 22
  • 151
  • 184