Thread: using classes is good thing?

  1. #1
    Unregistered Leeman_s's Avatar
    Join Date
    Oct 2001
    Posts
    753

    using classes is good thing?

    I've made it pretty far without having to use classes, or even know how to use them if I had to. Now just for the sake of organization, I think I should learn how to use classes. For those of you that use classes, is it a big advantage over structs?

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    It all depends on what you are doing. If you are writing a very simple program that doesn't really need classes surely do not feel obligated to use them. However, some programs lend themselves to inheritance in a particularly nice way. For instance you can have an abstract base class with certain private members and a pure virtual function called Render( ). Then you can have different objects derive from it and over-ride the Render function to their own specifications. Can you just make them structs and have a Render( ) functions , sure. Say you are writing a math library with points, vectors, etc. Obviously you can have vectors derive from points for their components. Somethings just lend themselves to classes easier I think.

  3. #3
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    Encapsulating functionality in self contained classes sees most benefit when program/system size increases. It is not generally difficult to keep track of what is going on in a program of a few thousand lines, but when you get up to, say, half a million lines or more, it really is a big task to keep on top of.

    Of course, classes are just one of the newer ways of doing this. Professional programmers have been modularising projects for this reason for years.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Multiple Inheritance - Size of Classes?
    By Zeusbwr in forum C++ Programming
    Replies: 10
    Last Post: 11-26-2004, 09:04 AM
  2. Do I need Classes ?
    By jjj93421 in forum Game Programming
    Replies: 3
    Last Post: 04-24-2004, 09:19 AM
  3. A good exercises book for C++
    By buffalo in forum C++ Programming
    Replies: 2
    Last Post: 01-20-2004, 12:32 PM
  4. Starting with classes: Your opinion
    By RoD in forum A Brief History of Cprogramming.com
    Replies: 17
    Last Post: 10-30-2002, 06:22 PM
  5. any good way to write sprite/animation classes for a game?
    By compjinx in forum Game Programming
    Replies: 2
    Last Post: 03-28-2002, 01:22 AM