Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 28
  1. #11
    Join Date
    Mar 2004
    Posts
    0
    Quote Originally Posted by swann View Post
    Hm... Wedgie, to be fair i don't see any OOP programming in your example. What you showed here is on the basic C level not C++.
    Since C++ is called "C with Classes" you should atleast use some classes here if you wan't compare those two languages.

    My two cents .
    C with classes my face

    C++ introduces quite a bit ontop of C that's more than just classes. It was originally called C with classes IIRC, but it was changed to C++ to more reflect that C++ introduced more than just OOP. Constants and templates (generics) come to mind that aren't directly related to OOP in C++...

  2. #12
    Join Date
    Aug 2005
    Location
    mantragora
    Posts
    763
    Quote Originally Posted by <> View Post
    C++ introduces quite a bit ontop of C that's more than just classes. .
    Thats why I sad "atleast" .

  3. #13
    Join Date
    Nov 2008
    Location
    41° 28′ 56″ N, 81° 40′ 11″ W
    Posts
    2,399
    Meh, I suppose your right, but I was just trying to show where the differences in a "multi-level" hello world console app were between C++ and C# to show him how different the languages are. That was the whole moral of the story with that one.
    PC Specs: Antec 900 ATX Case, Gigabyte 790GX Mobo, AMD Phenom II x4 955, Corsair HX620W PSU, Corsair Vengeance 16GB (4x4GB) DDR3-1600, EVGA GTX 680 2GB GDDR5, 3D Vision Kit 2, LG 8x Blu-ray Burner, Intel X25-M SSD, 500GB+640GB WD Caviar Blacks, Win 7 Pro x64, DAS Pro K/B, MX518 Mouse, Logitech Z-2300 Speakers, Toshiba 32TL515U 32" 3DTV, Wacom Bamboo Fun Large Tablet.

  4. #14
    Join Date
    Sep 2008
    Location
    Salisbury, UK
    Posts
    2,812
    Man, C++ is ugly when you put it right next to C#...

    I found
    my current avatar on google, so props to THIS GUY who created the original...

  5. #15
    Join Date
    Nov 2008
    Location
    41° 28′ 56″ N, 81° 40′ 11″ W
    Posts
    2,399
    Heh...never intended it to look ugly vs. C#, but that's just the way the languages were built, I suppose...

    [off-topic rant] Although I still have to wonder how C# and C++ would compare to that perk language in F#, tho.
    "Functional" still seems "experimental" to me, but that's only because it's still in beta for those that own the retail versions of VS. No word on when it'll be a standard language.
    There was talk about that language being open-sourced, but who knows? [/off-topic rant]
    Last edited by WedgeBob; 12-04-2010 at 07:52 PM.
    PC Specs: Antec 900 ATX Case, Gigabyte 790GX Mobo, AMD Phenom II x4 955, Corsair HX620W PSU, Corsair Vengeance 16GB (4x4GB) DDR3-1600, EVGA GTX 680 2GB GDDR5, 3D Vision Kit 2, LG 8x Blu-ray Burner, Intel X25-M SSD, 500GB+640GB WD Caviar Blacks, Win 7 Pro x64, DAS Pro K/B, MX518 Mouse, Logitech Z-2300 Speakers, Toshiba 32TL515U 32" 3DTV, Wacom Bamboo Fun Large Tablet.

  6. #16
    Join Date
    Mar 2004
    Posts
    0
    Quote Originally Posted by WedgeBob View Post
    Heh...never intended it to look ugly vs. C#, but that's just the way the languages were built, I suppose...

    [off-topic rant] Although I still have to wonder how C# and C++ would compare to that perk language in F#, tho.
    "Functional" still seems "experimental" to me, but that's only because it's still in beta for those that own the retail versions of VS. No word on when it'll be a standard language.
    There was talk about that language being open-sourced, but who knows? [/off-topic rant]
    Functional languages are faaaaaar from experimental. They've been used in practice for many, many, many years. In fact, the SECOND high level programming language (lisp) was a functional language, only beat by FORTRAN (imperative language) by a year (lisp: 1958, FORTRAN: 1957). Lisp is the grandfather to all functional languages, and although it wans't a very easy language to learn, it had all of the functional ideas that are used today by languages like Haskell and even F#.

    The reason functional languages were "buried" for so long in terms of general consumption was due to COBOL (1959). COBOL was what really brought programming into the enterprise because it was supposed to be so easy that an executive could program in it... and as a result, the general programming community stopped looking at functional programing.

    But then C# 3 was released (2007), and functional programming became mainstream again. It's kinda like 1959-2007 were the "dark ages" of functional programing, and as of 2007 we've entered the renaissance. Don't get me wrong, many languages have supported functional ideas for a very long time... But C# 3 brought it into the enterprise.

    Also, F# is a standard language... not only was it based heavily off of an existing standard language (OCamel), it's been out of BETA for a long time. In fact F# 2 was released recently (it comes with 2010 I believe) and the 2.0 compiler was open sourced as well

  7. #17
    Join Date
    Feb 2005
    Location
    Bellevue, WA
    Posts
    3,251
    Quote Originally Posted by wforl View Post
    Thats not true
    If you go by the definition of an object being an instance of a reference type, yes, it is true.

    The only things getting passed around are the pointers, which are hidden in C# under the guise of references. I guess if you want to be pedantic, everything is passed by value but most things in C# are instances of references types which means you are always passing around pointers to instances. Saying that the instance is passed by value is completely different then saying the instance is passed by reference, especially in the context of C++ and C#.

    "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." ~Rich Cook

  8. #18
    Join Date
    Oct 2006
    Posts
    1,548
    So then what happens when you pass around items which are declared as a struct type or built int types like int, float, char etc without the ref keyword, which every c#book i read call that passing by value.
    Last edited by wforl; 12-07-2010 at 05:17 PM.
    [quote][\quote]

  9. #19
    Join Date
    Mar 2004
    Posts
    0
    Structs are types that can implement interfaces and inherit from other types.


    Also, consider this code:

    Code:
    using System;
    
    namespace ConsoleApplication1
    {
    	class Program
    	{
    		struct Test
    		{
    			public int X;
    			public int Y;
    		}
    
    		static void Main()
    		{
    			var testInstance = new Test { X = 1, Y = 2 };
    			Action mutate = () => testInstance.X = 10; // editing a value object in a lambda?!
                            // Note that the C# compiler generates a class to hoist testInstance into, meaning for
                            // the purpose of this example, a reference to testInstance is being used. Also, it is
                            // allocated onto the heap because Main may return before that lambda gets collected.
    
    			Console.WriteLine(testInstance.X); // 1
    			mutate();
    			Console.WriteLine(testInstance.X); // 10
    
    			Console.ReadKey();
    		}
    	}
    }
    Structs are not guaranteeing to be immutable, or placed on the stack. Thinking of them in that way is incorrect.


  10. #20
    Join Date
    Nov 2008
    Location
    41° 28′ 56″ N, 81° 40′ 11″ W
    Posts
    2,399
    Hmm...yeah, that sounds like a new one on me, wforl. You of course need to call upon those items through other methods, obvisouly, and making sure that all classes are under a matched namespace...yeah, that does take a lot of thought. I'll have to look that up, thanks.
    PC Specs: Antec 900 ATX Case, Gigabyte 790GX Mobo, AMD Phenom II x4 955, Corsair HX620W PSU, Corsair Vengeance 16GB (4x4GB) DDR3-1600, EVGA GTX 680 2GB GDDR5, 3D Vision Kit 2, LG 8x Blu-ray Burner, Intel X25-M SSD, 500GB+640GB WD Caviar Blacks, Win 7 Pro x64, DAS Pro K/B, MX518 Mouse, Logitech Z-2300 Speakers, Toshiba 32TL515U 32" 3DTV, Wacom Bamboo Fun Large Tablet.

Page 2 of 3 FirstFirst 123 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
  •