Thread: Why C++ is not OOPS

  1. #1
    Registered User
    Join Date
    Jun 2007
    Posts
    219

    Why C++ is not OOPS

    Why some people says C++ is not OOPS ??
    I think C++ provides all OOPS facilities in a customized way.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    What's OOPS?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Jun 2007
    Posts
    219
    Hmm

    a very short question with a very huge answer!

    Object Oriented Programming Structure

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    I am afraid that I have never heard of that term (and a search of the Web reveals nothing much). How does it differ from object oriented programming? After all, C++ is a programming language, not a structure, though languages have structure.

    EDIT:
    Okay, I am reasonably certain that OOPS == OOP. Consequently, read Stroustrup's answer to the FAQ: Is C++ an Object-Oriented language?
    Last edited by laserlight; 10-20-2008 at 10:59 AM.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Registered User
    Join Date
    Jun 2007
    Posts
    219
    I've seen a lot people saying that.
    none of them shows me a valid reason
    I asked one of them she said with friend you can overrule public/private/protected etc..
    I said Its a feature of C++ that it lets you to do that you just dont use it If you dont like that feature.See said letting users doing that is not pure OOPS.
    I didn't understand.

    Others also say some nonsence things they say Java and .net is pure OOPS but C++ is not but they cant explain clearly the "Why"

  6. #6
    The larch
    Join Date
    May 2006
    Posts
    3,573
    I asked one of them she said with friend you can overrule public/private/protected etc.
    Yes, this sounds like nonsense. Outside code can't override anything, unless the class itself grants friendship.

    In a "pure" OOPL everything is an object, which indeed isn't the case in C++.
    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).

  7. #7
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    It's true that you can override private member functions of your base class. That doesn't mean C++ is not object-oriented, though.
    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

  8. #8
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    I am going to to go ahead and run with this OOPS acronym.

    "A new CS student." : Professor, what is C pound sign?
    "Mister C" : OOPS

    Sounds most excellent.

  9. #9
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    <chanting>Language war, Language war!</chanting>

    To be truthful, "non-obliging" parts of applications can do anything they like with an object. private, public and protected are there to help programmers, not to stop someone with an evil intent from causing troupble. If that was the case, we'd also prevent some pretty useful features in C++ (such as the ability to take the address of just about anything and turn it into a void pointer and operate on it as if it was a chunk of memory with no particular content, and then bring it back into the form of an object [of course, there are restrictions to how far you can take this).

    Different languages take different approaches to things. C++ is a "low-level language with object orientation". That allows it to do things that you are not able to do (with ease at least) in other, higher level, languages. That in itself does not eliminate it from the class of "object oriented" languages - but of course, that group is big, and different "language advocates" will have different view of what language is "in" and "out" of that group.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  10. #10
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Agreed. I think when one says OOP they typically think of Java or C#. They don't usually think of C++ or Delphi. I don't know that its a topic worth investing too much time into as it is not crucial to development in any particular way.

  11. #11
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    There certainly are different flavours of OOP, just like there are flavours of ice-cream. And a lemon sorbet doesn't recemble a very creamy chocolate-chip-cookie ice-cream, but they are still different forms of ice-cream. C++ is one OOP language, Eiffel, Simula-67, C#, Java, SmallTalk and many others are also OOP languages. If you then start saying "it must have X and Y to be a 'proper' OOP language", that's like saying "you must have cream in ice-cream", thus eliminating the sorbet from the group of ice-creams. And in some camps you'd be hailed as a true believer of ice-creams if you say that, but if you turn up at the "100th Anniversary Sorbet Makers Convention", you probably would be covered with various rotten fruits and vegetables pretty soon. Same applies to anyone turning up at a C++ convention claiming it is not an OOP language...

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  12. #12
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    Quote Originally Posted by matsp View Post
    There certainly are different flavours of OOP, just like there are flavours of ice-cream. And a lemon sorbet doesn't recemble a very creamy chocolate-chip-cookie ice-cream, but they are still different forms of ice-cream.
    Mmmm, lemon sorbet all the way!

    btw, I like Master5001's new definition best.

    Oh and one last thing:
    OOA + OOD + OOP = OOT
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  13. #13
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    I think you and I are on the same page, Mats, but I think our fundamental description sounds kind of like we have polar opposite stances. C++ uses objects, so why not call it an OOP language. But to that end, why not just call Python an OOP language. Or JavaScript. The point I was making is simply there is no use getting all caught up on strict or loose definitions.

  14. #14
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I definitely agree with Master5001 - we are on the same page. What I was trying to explain is that DIFFERENT (OOP) languages are like ice-creams, they come in different flavours, and someone coming from a particular angle would say that the other end of the range may not even belong in the same category.

    Depending on where you stand on particular issues, one may say that sorbet isn't "real ice-cream", or one may include it and many other things into the ice-cream grouping (is a frozen Mars-bar an ice-cream?). Likewise in the computer languages, there are some that "are well inside the common criteria", and others that end up on the "edge".

    [Me and iMalc would be in the same corner of the ice-cream parlour, that's for sure ;-)].

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Google oops
    By Decrypt in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 08-24-2006, 01:12 PM
  2. Oops, she did it again...
    By gcn_zelda in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 09-19-2004, 02:34 PM
  3. Oops.
    By adrianxw in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 03-18-2004, 10:01 AM
  4. OOPS!!!! I need help please read+reply!
    By minime6696 in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 10-14-2001, 02:51 PM