Thread: NOOB class question

  1. #16
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    Quote Originally Posted by wikipedia
    Object-oriented programming (OOP) is a programming paradigm that uses "objects" to manage software complexity.
    Quote Originally Posted by vart
    1. there is no such word classes in the definition of OOP
    How do you create an object in C++ without a class?

  2. #17
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    Quote Originally Posted by 7stud
    How do you create an object in C++ without a class?
    How do you use OOP without C++?
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  3. #18
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Quote Originally Posted by 7stud
    How do you create an object in C++ without a class?
    Depending on whether you see structs as different from classes, you can't (with any sane amount of work - actually you can with some brutal hackery). But that's not the point. OOP is independent of C++. Just because classes are the only proper way to get OOP in C++, doesn't mean that OOP generally depends on classes. JavaScript's prototype system is also object-oriented, but JS doesn't have classes (yet).

    Definitions I like are from James O. Coplien's book "Multi-Paradigm Design for C++". He distinguishes between object-based programming and object-oriented programming.
    In C++, object-based programs are programs which use simple classes and objects instantiated from them, like std::string, std::complex and similar utilities. (The fact that they're templates aside.)
    To be object-oriented, a program needs to use inheritance and polymorphism.
    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

  4. #19
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    Wow, this debate will go down well on the GD board. I think everybody is correct. Classes and OOP form a partnership. Look at C#. It is more or less pure OOP.
    Double Helix STL

  5. #20
    Registered User
    Join Date
    Sep 2005
    Posts
    142
    Question?

    Is one idea with classes to incorperate modular programming instead of being dependant on only modular programming?

    also i'm probably jumping the gun but is inheritence classes sharing members?
    Last edited by wart101; 01-10-2007 at 04:24 PM.
    WhAtHA hell Is GoInG ON

  6. #21
    Registered User
    Join Date
    Sep 2005
    Posts
    142
    Yo any answers? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    WhAtHA hell Is GoInG ON

  7. #22
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    > Is one idea with classes to incorporate modular programming instead of being dependent on only modular programming?

    I have no idea what you are asking here.

    > also i'm probably jumping the gun but is inheritance classes sharing members?

    Define sharing.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  8. #23
    Registered User
    Join Date
    Jan 2007
    Posts
    8
    Using classes gives you objects, it depends on how you implement these objects that make the program object oriented not just object containing. For instance if a program had one class and one instance of the class and used each method only once, I would consider that procedural, not object oriented.

  9. #24
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    Yo any answers?
    Yes, along with not being able to understand answers to your questions, you don't have enough knowledge about OOP and classes to even ask meaningful questions. Nothing wrong with that. I know that I can't ask meaningful questions about large swaths of C++.

    At this point in your education, there is no need to waste time on such issues. Learn the mechanics. Things will become clearer. But the programming techniques spawned by OOP are vast, and you can spend a lifetime probing their mysteries.
    Last edited by 7stud; 01-10-2007 at 06:30 PM.

  10. #25
    Registered User
    Join Date
    Sep 2005
    Posts
    142
    Look sorry if my question are based on a ignorance but i have to ask anyway, i understand that there is no need to know about the things that i might be asking but i feel as though i have to, if what i am saying makes no sence all i ask for i honesty and i thank you for giving it to me.

    the basis for my question is from something i read

    In computer science, a module is a software entity that groups a set of (typically cohesive) subprograms and data structures.
    now i took that with an answer from this guy

    Quote Originally Posted by vart

    Quote:
    Originally Posted by wart101
    a more OOP would use a function to do the search


    Code:
    #include <iostream>

    using namespace std;

    void serC(char a) {

    // search code in here

    }



    int main(){


    char a;

    cout<<"please type a word to be search > ";
    cin.get(a);

    serC(a);

    }


    is that what defines OOP?

    No - it is what defined module programming. When you take the portion of the code that executes some action and make it a module (function in C) - it means you start using module approach to the programming.

    OOP is the next step
    __________________
    as well as this

    Object-oriented programming (OOP) is a programming paradigm that uses abstraction to create models based on the real world. It utilizes several techniques from previously established paradigms, including inheritance, modularity, polymorphism, and encapsulation
    and i asked the question, is one idea to use modularity in your classes?

    perhaps my question should have been more defined,

    IN MY QUEST TO UNDERSTAND OOP SHOULD I BE USING MODULES IN MY CLASSES?
    Last edited by wart101; 01-10-2007 at 09:18 PM.
    WhAtHA hell Is GoInG ON

  11. #26
    Registered User
    Join Date
    Sep 2005
    Posts
    142
    if you don't mind how long have you guys been programming for?
    WhAtHA hell Is GoInG ON

  12. #27
    Registered User
    Join Date
    Sep 2005
    Posts
    142
    Yo answers?
    WhAtHA hell Is GoInG ON

  13. #28
    Me
    Join Date
    Jul 2006
    Posts
    71
    How about being patient? You only waited half an hour.

  14. #29
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    Yea patience is a thing of requirement on boards. One, people here have to work, two they mightnot be on their comps, or maybe even three they are not in the mood for answering questions. Just be patient your answers will come. As for me I have been programming for almost 2 years. Also, in most situations ( as I have found ) use OOP if and only if it is needed or necessary. Something like a basic media player, or a text based game generally wont need it. Yet if you are going to be making a large scale full blown media player ( similar to WMP ) then yea it is necessary for easy maintenance. Changing one function or variable, or adding those is much easier in a class because you dont have to hunt through 1000's of lines of code. you just change it in your class, and Tada it changed. That may seem a little unclear but think about it for a second, and it should become clear. Although I am one of the more inexperienced people on the boards so may not be smart to take my advice without asking a pro first.

  15. #30
    Registered User
    Join Date
    Jun 2004
    Posts
    201
    Quote Originally Posted by g4j31a5
    It is useful for writing a big projects which have a long lifecycle because the maintenability (dunno if the spelling is right ) is better than modular programming.
    this is not necessarily true. As was said in this thread too, more and more programmers get convinced that OO actually is *not* the way to go and that it's easier to maintain procedural programs. It certainly is the solution to everything

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  2. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  3. My Window Class
    By Epo in forum Game Programming
    Replies: 2
    Last Post: 07-10-2005, 02:33 PM
  4. question about DLL's and class functions
    By btq in forum Windows Programming
    Replies: 2
    Last Post: 02-25-2003, 06:08 AM
  5. gcc problem
    By bjdea1 in forum Linux Programming
    Replies: 13
    Last Post: 04-29-2002, 06:51 PM