CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    Join Date
    Apr 2005
    Posts
    287

    C++,C#:which main differences?

    Hi,
    i would like to attend a course based on visual C++,but i haven't found anything so far.Instead,i've found interesting courses based on C#.
    Now i've got two questions:

    1)Is it convenient for me to attend a course based on C#?I mean,are C# and C++(or,better,visual C++ and visual C#)similar or are they so different?

    2)Can you give me some good link regarding courses on visual C++?

    Thanks in advance

  2. #2
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: C++,C#:which main differences?

    C# and C++ are pretty different. For example, C# has garbage collection that will automatically cleanup memory of unused objects. Standard C++ doesn't have that.

    Basically, when you know C++ it's much easier to learn C# than the otherway around. So learning C# won't help you much if you want to learn C++.
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  3. #3
    Join Date
    Oct 2000
    Location
    London, England
    Posts
    4,773

    Re: C++,C#:which main differences?

    I wouldn't really use garbage collection as the main difference. You can easily take care of memory management by using smart-pointers and by using standard containers instead of using raw pointers.

    In C#, like in Java, all your objects are created with new. In C++ you can create objects that way or you can create them on the heap.

    In C#, like with Java, the basic language is fairly straightforward. What you need to learn is the libraries. In C++ you also need to learn to use the libraries.

    In both cases, knowledge of the language and its libraries alone does not make you into a good programmer. You must apply them well too. Some knowledge of Object-Orientated design (and in the case of C++, knowledge of algorithms) will help.

    It really depends on what you are writing for. If you want to write add-ins for Excel then I'd suggest you use the .NET framework which would probably mean C# which is the main language for the .NET framework. If you are writing a major server that you want high performance in real-time, write it in C++.

  4. #4
    Join Date
    Dec 2002
    Location
    London, UK
    Posts
    1,569

    Re: C++,C#:which main differences?

    Completely different... the only thing similar is the syntax. But is where it ends. Different programming paradym completely.

    To program C++, I would probably recomend getting a SAMS book. They're pretty good generally. I have never read the C++ book though.
    Mike

  5. #5
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652

    Re: C++,C#:which main differences?


  6. #6
    Join Date
    Apr 2005
    Posts
    287

    Re: C++,C#:which main differences?

    First of all thanks for your answers

    My question was basically due to a doubt i have:what is the future of Visual C++?
    This doubt was born some weeks ago,when i was searching for a good training course on this language:i've encountered some problems in finding someone.Instead,i've found easily a lot of courses regarding Java,C#,asp and so on.

    So i repeat the question asked above,because i'm sure i'm in the right place to have a good answer:what is the future of Visual C++?
    is Visual C++.NET better?
    which programming language would you suggest me to learn in a serious way(consider i know a few C++)?

  7. #7
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652

    Re: C++,C#:which main differences?

    I don't know where people get those information all the time....MFC is dying, Visual C++ is dying etc.

    First of all, you have to differentiate between Visual C++ and C++. The former is just a C++ compiler that comes with an integrated development IDE, the latter is a language. Having said this, your question would rather:

    What is the future of the Microsoft CLI extensions they added to C++? Currently, it is kind of hard to tell. Microsoft added some extensions to the core C++ language to make if compatible with their .NET framework. They also communicate with the C++ standardization people to see whether these kind of extensions (or a subset) will become part of the next C++ standard.

    Besides that...the C++ compiler is by far the most efficient one in regard to compile managed code. It is highly optimized to produce fast managed code and thus, does it better than any other compiler such as the C# or VB.NET one. In other words...the C++ compiler compiles the most optimized managed code.

    These two things should give you a hint whether Microsoft considers C++ out of date or not....

    In regard to you learning question...it kind of depends what you want to program. Given that you already seem to know some C++, I would probably continue with C++ in the first place. ONce you have learned it, you can easily switch to other languages. On the other sie, if you rather program GUI-based applications (maybe with database interaction etc.), I would rather suggest using C# or VB.NET which make things much easier in this regard.

    There is no one language...the key ability of a developer is to be able to choose the right programming language for a specific job....based on the timeframe, costs, project requirements etc.

  8. #8
    Join Date
    Jun 2002
    Location
    Moscow, Russia.
    Posts
    2,176

    Re: C++,C#:which main differences?

    Why C# in place of C++, not Java or something else? C# is mostly Microsoft thing and it's not considered all-purpose language.
    "Programs must be written for people to read, and only incidentally for machines to execute."

  9. #9
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: C++,C#:which main differences?

    Quote Originally Posted by RoboTact
    Why C# in place of C++, not Java or something else? C# is mostly Microsoft thing and it's not considered all-purpose language.
    There are C# compilers for other platforms such as Linux, so it's not entirely a Microsoft thing. See the Mono compiler.
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  10. #10
    Join Date
    Oct 2000
    Location
    London, England
    Posts
    4,773

    Re: C++,C#:which main differences?

    C# is not meant to be an all-purpose language, it is meant to be a language to program under the .NET framework for specific types of application.

    True that on the whole it is not multi-platform but it's not really meant to be.

    One of the major downsides of C++ is that it is lacking in standard libraries with regard to network technologies, graphics/GUI and concurrency (threads).

    There are some open-source libraries being written to fill in these gaps but they are not standard.

    Take a first course in C++ and you'll be writing console apps with tricky cout/cin statements to implement something that looks like an application out of the 1980s. No wonder people find Java more attractive, where you are likely be writing an app that runs in a web-browser, and when programming C++ will tend towards MFC which provides some basic GUI (albeit that the concept of an application that isn't a document editor that has a menu is too complex to be in the application wizard).

  11. #11
    Join Date
    Jun 2002
    Location
    Moscow, Russia.
    Posts
    2,176

    Re: C++,C#:which main differences?

    Quote Originally Posted by Marc G
    There are C# compilers for other platforms such as Linux, so it's not entirely a Microsoft thing. See the Mono compiler.
    That's why I used that 'mostly' word.
    "Programs must be written for people to read, and only incidentally for machines to execute."

  12. #12
    Join Date
    Apr 2005
    Posts
    287

    Re: C++,C#:which main differences?

    Quote Originally Posted by Andreas Masur
    I don't know where people get those information all the time....MFC is dying, Visual C++ is dying etc
    It was just a personal feeling,i haven't read it anywhere!
    I'm very far from being an expert of this arguments,so,at this stage,i base my opinion on personal feelings:that's why when i post my attitude is that of a learner programmer,not of an expert one .
    But,as i've already said,this feeling was partially confirmed by that lack of visual C++ courses.

    Quote Originally Posted by NMTop40
    One of the major downsides of C++ is that it is lacking in standard libraries with regard to network technologies, graphics/GUI and concurrency (threads).

    There are some open-source libraries being written to fill in these gaps but they are not standard.

    Take a first course in C++ and you'll be writing console apps with tricky cout/cin statements to implement something that looks like an application out of the 1980s. No wonder people find Java more attractive, where you are likely be writing an app that runs in a web-browser, and when programming C++ will tend towards MFC which provides some basic GUI (albeit that the concept of an application that isn't a document editor that has a menu is too complex to be in the application wizard).
    This is one of my personal feelings...

    Quote Originally Posted by Andreas Masur
    Besides that...the C++ compiler is by far the most efficient one in regard to compile managed code. It is highly optimized to produce fast managed code and thus, does it better than any other compiler such as the C# or VB.NET one. In other words...the C++ compiler compiles the most optimized managed code.
    I'm happy of this:my main concern is writing fast applications,eventually based on a relatively simple GUI(but i would like,for the future,to create richer GUIs).
    Some questions:i've heard about managed C++.You speak about managed code:are they the same concepts?
    But most of all,what is managed C++?
    Is Java compiled or interpreted?(sorry for my ignorance....)

  13. #13
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: C++,C#:which main differences?

    Quote Originally Posted by Fraben
    Is Java compiled or interpreted?(sorry for my ignorance....)
    Java is compiled to bytecode which is not machine code. This bytecode is then interpreted by the Java virtual machine.
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  14. #14
    Join Date
    Jun 2002
    Location
    Moscow, Russia.
    Posts
    2,176

    Re: C++,C#:which main differences?

    Not exactly interpreted - it's partially compiled on target machine.
    "Programs must be written for people to read, and only incidentally for machines to execute."

  15. #15
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652

    Re: C++,C#:which main differences?

    Quote Originally Posted by Fraben
    Some questions:i've heard about managed C++.You speak about managed code:are they the same concepts?
    Well...no...managed code is code that is 'managed' by some kind of run-time environment. With Java it is the virtual machine, with .NET it is the .NET framework.

    Managed C++ was just the implementation of the managed components for C++.

    Quote Originally Posted by Fraben
    But most of all,what is managed C++?
    Managed C++ was the first version of some C++ extensions Microsoft did to support the .NET framework. It has now been replaced with C++/CLI which are C++ extensions that bind the C++ language to the ECMA standard Common Language Infrastructure (CLI). These extensions are currenlty in the process of being standardized by the ECMA and are also being discussed to be integrated into the next C++ standard.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured