I have some very rusty C++ and lots of C experience, but have done little OO design or coding. I've started learning C++.N开发者_如何学编程ET as that seemed to be the best starting point.
I've hit restrictions in Microsoft's provision with multiple inheritance and extensions, neither work in C++.
Would I be better off starting again with C#, or am I better off using a mixed language approach. eg. extensions in C#, rest in C++?
I'm still struggling with this->method or that.property and theother::staticthingy or whatever, and this probably is not an issue in C#. You'll see what I mean as that probably isn't the right way to desribe the difference between '->' '.' and '::'
I'm getting to achieve what I want, but it's taking me 10 times longer than I think it should.
Is C# any quicker?
MS wants you to use C#, so use C#. If your C++ is rusty, you'll end up wasting time learning a difficult language, which is actually a second class citizen in the .NET world.
However, C++ in the .NET world (called C++/CLI) is a wonderful tool to wrap existing non-.NET code into .NET classes.
For the multiple inheritance thing, C# supports inheriting multiple interfaces (à la Java), which is by far the most useful use case of multiple inheritance.
If you plan on going the .NET route I would personally recommend going the C# route. I see a greater number of support for C# related question and more code examples geared towards .NET. That is just from personal experience. C# is the highest traffic tag on stack overflow.
I think C# is a bit more sane that C++. However, you're still not going to get multiple inheritance.
That said, be sure to pick the right tool for the job. If you absolutely need C++ (and this is becoming more rare every day) then stick with it.
Otherwise, save your sanity and move to C#.
if you got good knowledge in C then C# should be more interesting and easy.
Though I believe this is more a programmers.SE question, here's my $.02.
I would start with C++. Build an appreciation and understanding for memory management, structures, cleanup, etc. then move to .NET. The Garbage Collector (GC) is nice, but going in to a language that's that "loose" with structure and beginning (IMHO) sets for a poor foundation moving forward.
If you understand what's going on in the background, you'll have a better mind set when developing (keeping a conscience mind of memory and resources).
Just my belief, anyways.
If you want to get into AAA gaming (or a job that requires C++) start learning C++.
Otherwise, C# is much newer and well refined, making it easier/quicker to learn (imo)
C# is a very easy-to-grasp language. I first learned unmanaged C++ a long time ago, and honestly C++ syntax has changed so much since then I don't recognize it anymore. Before I started programming in C# regularly, my previous C-ish language had been Java, and if you know Java, you can learn C# very easily. Also, from a business perspective, C# is by far the most popular .NET language in terms of how many people want C# programmers, as opposed to VB, C++.NET or F# programmers.
In C#, there is no syntactic difference between, for instance, a member of a class referenced by a pointer, and a member of a class instantiated locally, because in C#, pointers, though they exist, are hidden behind a LOT of abstraction. Everything is a "reference" (if it isn't a simple "value type"), and is passed around as such, so referencing a child of an object is always done with dot notation.
精彩评论