Results 1 to 5 of 5

Thread: class concept

  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    61
    Blog Entries
    1

    class concept

    i really don't know how to explain this properly, so sorry if it'll confuse you.

    everyone knew class concept introduced since c++. as in my learning process in college, it's just really like a passing by, heard from left ear and gone out thru the right one. well, in at least i pass the exam. after some years, i still really can't grasp the class concept. i was once learn to code a visual component in delphi, which is using somekind of inheritance. from there i learn a bit about what kind of class, from delphi point of view.

    a tale like, at first there is a code, and then there is a variable, then there is a class, well it just maybe. so, the class is somewhat providing a way to accomplish a task where a code and variable alone can do? or else?

    i was always thought that OOP in game dev, should at least give a simple concept about how class concept is. i knew in delphi, class consists some vars and some functions. those functions then interact as it is a single object providing a common interface. it still blurry, as i don't really know why is there a class, should code and var alone can't do?

    regards

  2. #2
    |< x != '+' BanMe's Avatar
    Join Date
    Oct 2008
    Location
    Farmington NH
    Posts
    510
    Blog Entries
    4
    classes provide modularized behaviors to acomplish a task yes..
    well classes arent really needed..so var and code works as well as a class which is code/var all put neatly coded together..so either works.
    No hate for the lost children;
    more love for the paths we walk,
    'words' shatter the truth we seek.
    from the heart and mind of Me
    me, to you.. down and across

    No more words from me, to you...
    Hate and love shatter the heart and Mind of Me.
    For the Lost Children;For the paths we walk; the real truth we seek!

  3. #3
    Registered User
    Join Date
    Jan 2008
    Posts
    163
    Blog Entries
    19
    In theory you can write everything in assembly. =)

    The point of classes is how you organize you code. Classes and templates save you from writing the same code more times, by inheriting a class you inherit certain behaviors, which you can also costumize by using virtual methods. You could do it all manually through structures and function pointers, but it would be a mess.

    Similarly a template makes you re-use your code on different types. It all comes down to you, the dev, writing less code.

  4. #4
    Registered User
    Join Date
    Jul 2007
    Posts
    61
    Blog Entries
    1
    thank you for the simple and direct answers.

    i think i've forgotten the way to learn in this, because to answer right is somewhat more important than seeing why need those things, yes, a typical short minded (like me) would just have followed the lesson without questioning it, because the lesson itself somewhat boring.

    actually, i took times to google and read about it, but still confused.

    [rant]i just remembered seeing a c++ source code, that like i can see class everywhere. i thought myself, gee... why such a simple code become a class member?? and i thought... can't we really live without class??
    well, maybe it just my impression. but i started to think people tend to forget the class purpose, and did even simple things with class.[/rant]

    but thanks again for the answer

  5. #5
    Registered User
    Join Date
    Jan 2008
    Posts
    163
    Blog Entries
    19
    C++ can be overused, that's true. It doesn't make much sense having a class if u just have one method in it with no class members.

    Rememebr that C is used to write entire frameworks and operating systems. But try comparing the use of a char *str; string compared to a QString. You'll see the elegance of QString and even safety (no easy buffer overflows).

    That said, it is up to you to decide what you need, but I hate to develop user mode code without objects.

    Just consider the use of templates, which makes you save lots of efforts, let's say u need an array of a class of yours called "Contact".

    List<Contact> mylist;
    mylist.append(Contact("Mark Twain", Friend, Date(11, 02, 77)));

    Now, do the same in C. You can technically, of course, but it will look very differently.

Similar Threads

  1. Replies: 2
    Last Post: November 26th, 2007, 15:18
  2. Not real clear on the concept!
    By SiGiNT in forum Off Topic
    Replies: 2
    Last Post: January 17th, 2007, 14:58
  3. How do you bpx on a class method??
    By Jacques in forum The Newbie Forum
    Replies: 5
    Last Post: May 31st, 2004, 00:05
  4. Solid concept
    By sirius in forum Malware Analysis and Unpacking Forum
    Replies: 3
    Last Post: May 11th, 2003, 18:11
  5. A new class... join now!
    By Rage9 in forum Mini Project Area
    Replies: 32
    Last Post: July 29th, 2001, 16:55

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •