How properly inherit from template?

This is a discussion on How properly inherit from template? within the C++ Programming forums, part of the General Programming Boards category; We certainly seem to have hijacked this thread "most excellently" considering we seem to agree on everything. ^_^ 6tr6tr seems ...

  1. #31
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,109
    We certainly seem to have hijacked this thread "most excellently" considering we seem to agree on everything. ^_^
    6tr6tr seems to be taking it in quite well though. He/she probably agrees with us
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  2. #32
    Registered User
    Join Date
    Nov 2006
    Posts
    184
    Quote Originally Posted by laserlight View Post
    6tr6tr seems to be taking it in quite well though. He/she probably agrees with us
    Actually, I'm just enjoying learning from the in-depth conversation (and I already got the answer I needed ;p ). Please continue!

  3. #33
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,888
    I find it ironic that STL would not be made OO since it was designed specifically for C++ and C++ is an object-oriented language.
    I see now why the classes are so lacking in the OO area.
    All the more reason to make a C#-ish framework!
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #34
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,356
    C++ is an object-oriented language.
    No it isn't, but it does have support for object-oriented techniques. (C++ is billed as a multi-paradigm language.)

    If it was an "object-oriented language", as Smalltalk or Java, I wouldn't be using it.

    Soma

  5. #35
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,888
    I fail to see how it is not OO. Maybe not 100%, but OO is heavily utilized in C++ most times.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #36
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,109
    I fail to see how it is not OO. Maybe not 100%, but OO is heavily utilized in C++ most times.
    Well, the point of "multi-paradigm" is that it includes OO, but with (first class?) support for other programming paradigms.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  7. #37
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    OO, procedural, and generic, and I'm with soma - I wouldn't use it if everything had to be an object. Blech.

  8. #38
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,356
    OO is heavily utilized in C++ most times.
    That's just it though, it is utilized; it is not forced. I get to mix and match whatever techniques, including any of the various "OOP" techniques C++ supports, might be most applicable.

    Well, the point of "multi-paradigm" is that it includes OO, but with (first class?) support for other programming paradigms.
    Well, with C++ pretty much everything seems like a second class citizen--which I suppose is the best thing about it.

    OO, procedural, and generic, and I'm with soma - I wouldn't use it if everything had to be an object. Blech.
    You forgot functional. Sure, there are a lot of bits of a traditional FP that C++ lacks, but C++ lacks just as many traditional "OOP" bits and people have no problem with that association.

    Soma

  9. #39
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,888
    I dare say C++ wouldn't be the same without classes. Classes are basics to C++. It's combined with other methods, as well perhaps, but things like RAII is a pretty big backbone to C++ which makes it so powerful.
    And yet those who designed the library didn't really take advantage of all that power. I find that right out stupid, no matter how they argue it.
    I feel that they ruined the standard library. It could have been a lot more than it is, but it wasn't. Instead we're stuck with some half-baked implementation.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  10. #40
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Quote Originally Posted by phantomotap View Post
    You forgot functional. Sure, there are a lot of bits of a traditional FP that C++ lacks, but C++ lacks just as many traditional "OOP" bits and people have no problem with that association.
    I'll bite. What OOP "bits" is it missing?

  11. #41
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,356
    I dare say C++ wouldn't be the same without classes.
    Of course it wouldn't, but that has nothing to do with anything. (It wouldn't be the same if any changes were made, or if decisions had been made differently.)

    It's combined with other methods, as well perhaps, but things like RAII is a pretty big backbone to C++ which makes it so powerful.
    'RAII' has nothing to do with classes. (It does in C++, but not at the conceptual level.) No 'RAII' mechanism is possible in any number of languages that have classes. A few languages have scoped garbage collection that do not have classes.

    I feel that they ruined the standard library.
    Hardly. A mistake, or oversight, surely, but nothing that "ruins" the library.

    It could have been a lot more than it is, but it wasn't.
    The only reason we can say that: we've had a decade to examine the C++ machine. (The standard guys had a relatively short time.) Hindsight is an amazing thing.

    I'll bite. What OOP "bits" is it missing?
    A strange comment indeed! O_o (I said ""OOP" bits" not "OOP "bits"". ^_^)

    Direct support for anonymous message passing--invoking a method on a type that may not actually support that method--and multiple parametric polymorphisms would be a favorite. (Yes, they can be emulated, but they can be emulated in C, or even assembler, as well so it isn't worth discussing emulation.)

    Soma

  12. #42
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,888
    Anyway, those are just my thoughts on the whole. They don't necessarily reflect the whole truth.
    The standard library contains some good functions, like vector or map, but beyond that I really don't use it. It's too separated and non-OO. Methods were broken out in favour of encapsulation (which is wrong; you can keep encapsulation by still making methods part of the object by calling common interfaces or public access methods instead of touching the internals), plus classes are lacking common methods for actions and algorithms should be avoided, because they complicate the code. There should be appropriate member functions to do all that stuff. At least for simple things such as turning a string all into lower case.

    It's a lot of stuff I really don't agree with.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  13. #43
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Quote Originally Posted by phantomotap View Post
    Direct support for anonymous message passing--invoking a method on a type that may not actually support that method--and multiple parametric polymorphisms would be a favorite.
    Nor does it have direct support for reflection, or a common base Object, as other OO-languages have. It does however, have direct support for inheritance, run-time polymorphism, encapsulation, and abstraction without those things.

  14. #44
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Quote Originally Posted by phantomotap View Post
    Direct support for anonymous message passing--invoking a method on a type that may not actually support that method--and multiple parametric polymorphisms would be a favorite.
    Even Smalltalk and Eiffel don't support multiple dispatch.
    Anonymous message passing is a feature of dynamic languages, rather than object-oriented languages. Java, C# and Eiffel (all statically typed OO languages) do not support it, except the hard way through reflection.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  15. #45
    The larch
    Join Date
    May 2006
    Posts
    3,573
    Quote Originally Posted by Elysia View Post
    Anyway, those are just my thoughts on the whole. They don't necessarily reflect the whole truth.
    The standard library contains some good functions, like vector or map, but beyond that I really don't use it. It's too separated and non-OO. Methods were broken out in favour of encapsulation (which is wrong; you can keep encapsulation by still making methods part of the object by calling common interfaces or public access methods instead of touching the internals), plus classes are lacking common methods for actions and algorithms should be avoided, because they complicate the code. There should be appropriate member functions to do all that stuff. At least for simple things such as turning a string all into lower case.

    It's a lot of stuff I really don't agree with.
    Ouch. I though the algorithms library was the most OOP part of standard libraries - container objects interacting with contained object interacting with predicate objects etc. If you use it to the full, the calls might look a bit more verbose and a bit less readable than ideal, but I don't see how the problem comes from the algorithms being free functions (the most complicated part is the predicates). And do you find it bad that you can also sort arrays, not just vectors?

    Would you say that given the two following options the second is poor programming?
    Code:
    string s;
    s.to_lower(); //hypothetical member function
    to_lower(s); //boost/algorithms/string.hpp
    Exactly how is the second way more complicated?

    I wouldn't mind having the second one in the standard libraries, though.
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

Page 3 of 8 FirstFirst 12345678 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Specialising a member function with a template template parameter
    By the4thamigo_uk in forum C++ Programming
    Replies: 10
    Last Post: 10-12-2007, 05:37 AM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 03:39 PM
  3. error: template with C linkage
    By michaels-r in forum C++ Programming
    Replies: 3
    Last Post: 05-17-2006, 09:11 AM
  4. Class Template Trouble
    By pliang in forum C++ Programming
    Replies: 4
    Last Post: 04-21-2005, 05:15 AM
  5. oh me oh my hash maps up the wazoo
    By DarkDays in forum C++ Programming
    Replies: 5
    Last Post: 11-30-2001, 12:54 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21