Thread: have to learn this stuff...

  1. #1
    5|-|1+|-|34|) ober's Avatar
    Join Date
    Aug 2001
    Posts
    4,429

    have to learn this stuff...

    ok, so in my search for a new job, I'm finding that almost everyone is asking for someone that knows C++. That's fine, problem is, I DON'T KNOW ANY.

    I know loads of C and have even taken 2 classes strictly on it. I just never had the need to dive into C++. So i guess my main question is how different are they?

    And can someone give me a sample program (somewhat complex) so that I can at least start looking at some code?
    EntropySink. You know you have to click it.

  2. #2
    Registered User
    Join Date
    Nov 2002
    Posts
    1,109
    C++ is object-oriented programming. that is the main difference. once you get the hang of OOP, then you should be fine. as for code, you could just click on a few threads and look through the code. but do remember, things do need debugging.

    edit: Also, classes are used in C++ to create new classes (lack of a better word). ex.
    Code:
    Class object;
    
    object.doSomething();
    that would be an example of creating an object of a Class that is not a built in type.

    Structs in C++ are used similarly as classes, and are different than those used in C. Structs differ with classes only in that structs default to public and classes default to private.

    I hope this helps some.
    Last edited by alpha; 01-23-2003 at 08:11 AM.

  3. #3
    Registered User
    Join Date
    Dec 2002
    Posts
    103

    Read the book "Thinking in C++"

    It can be downloaded from the net in PDF or HTML form. Its real good.. and must help you to migrate smoothly from C to C++

    Book "Thinking In C++" by Bruce Eckel
    Last edited by shiv_tech_quest; 01-23-2003 at 08:20 AM.
    Have a wonderful day.... and keep smiling... you look terrific that way
    signing off...
    shiv... as i know him

  4. #4
    5|-|1+|-|34|) ober's Avatar
    Join Date
    Aug 2001
    Posts
    4,429
    thanks for the advice.

    Alpha, so with classes... that's similar to Java classes? And i know I need to brush up on my OOP. I've been a VB programmer for the past year or so for my company and used little C, but have plenty of C knowledge from my undergrad work which I'm finishing up this spring.
    EntropySink. You know you have to click it.

  5. #5
    Registered User
    Join Date
    Nov 2002
    Posts
    1,109
    I don't know if c++ are similar to java classes, i haven't learned java yet. I also recommend Bruce Eckel's book.

  6. #6
    Registered User
    Join Date
    Jan 2003
    Posts
    1

    Talking Similar

    Hi,

    F.Y.I Java and C++ classes are quite similar with some exceptions:

    - functions don't need to be prototyped in java

    - java has 'automatic garbage collection', this means when we create a new object we don't need to call a ~destructor to free the memory occupied by the object, it is done automatically by the compiler. It does offer a finalize keyword which can be used like a destructor, but thats another ball game

    - everything written in java must be encapsulated within {} preceeded by the name of the class



    e.g:

    class myclass
    {
    public static void main (String args[])
    {

    }


    void myfunction(void)
    {

    }

    }//end class myclass

    Barry

  7. #7
    5|-|1+|-|34|) ober's Avatar
    Join Date
    Aug 2001
    Posts
    4,429
    There are 2 versions of that book. The first one that is "out of print" and then Introduction to Standard C++ 2nd Edition. Which one?
    EntropySink. You know you have to click it.

  8. #8
    5|-|1+|-|34|) ober's Avatar
    Join Date
    Aug 2001
    Posts
    4,429

    Re: Similar

    Originally posted by Barry
    Hi,

    F.Y.I Java and C++ classes are quite similar with some exceptions:
    .........
    Barry
    excellent This might not be as hard of a switch as I thought.
    EntropySink. You know you have to click it.

  9. #9
    Senior Member joshdick's Avatar
    Join Date
    Nov 2002
    Location
    Phildelphia, PA
    Posts
    1,146
    Ober, it is entirely possible(and frequent) for people to code in C++ without using OOP. If those employers just want you to know <iostream> and little stuff like that, you could get all of that down in a day or two. However, OOP is a whole different way of thinking about a problem. Fortunately, a good number of C++ books are written specifically for people who already know C. I also recomend Bruce Eckel's Thinking in C++. He assumes that the reader already knows some C or C++, but not OOP. I wish you luck learning OOP and with your job search
    FAQ

    "The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs." -- Joseph Weizenbaum.

    "If you cannot grok the overall structure of a program while taking a shower, you are not ready to code it." -- Richard Pattis.

  10. #10
    5|-|1+|-|34|) ober's Avatar
    Join Date
    Aug 2001
    Posts
    4,429
    ahhh!! Didn't anyone see my post? I said there were 2 versions of that book! Can you please tell me which one you all read?

    but thanks for the advice. I've done some OOP with Java and I have a decent understanding of it... I just don't know some of the syntax of C++ and I'd like to get a better grasp of C++ OOP.
    EntropySink. You know you have to click it.

  11. #11
    this site right here explains C++ basics pretty well. Also, you can try www.cplusplus.com

    I've only read one programming book, and it was just an old C game programming book, came out b4 C++ got popular. The only thing I really learned from it was how to optimise stuff. I learned everything else by myself, with a little help of the internet.

    Just as they said, you don't need OOP to use C++. In fact, I used C++ for 6 months b4 I even made my first class.

  12. #12
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    > Just as they said, you don't need OOP to use C++.

    What's the point of using C++ if you're not doing OOP? Why not just use C in that case?

  13. #13
    5|-|1+|-|34|) ober's Avatar
    Join Date
    Aug 2001
    Posts
    4,429
    That's what I was thinking. I thought the whole purpose of C++ was to use OOP.
    EntropySink. You know you have to click it.

  14. #14
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    Originally posted by ober5861
    That's what I was thinking. I thought the whole purpose of C++ was to use OOP.
    So did I; but there's many too many people out there who claim they know C++ by including iostream in their C program.

    After you've got the basics down... I seriously suggest you pick up "Effective C++" by Scott Meyers... it's the most amazing book i've read to date. There's also "More effective C++" and "Effective STL"

  15. #15
    5|-|1+|-|34|) ober's Avatar
    Join Date
    Aug 2001
    Posts
    4,429
    >>Book "Thinking In C++" by Bruce Eckel

    Originally posted by ober5861
    There are 2 versions of that book. The first one that is "out of print" and then Introduction to Standard C++ 2nd Edition. Which one?
    Can someone answer this question please?!
    EntropySink. You know you have to click it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Looking to learn C++
    By Fuzzy91 in forum C++ Programming
    Replies: 40
    Last Post: 04-13-2006, 02:38 AM
  2. Book for Newbie trying to learn C
    By uthscsa19 in forum C Programming
    Replies: 23
    Last Post: 12-24-2005, 11:02 AM
  3. Can you actually learn c++ in 21 days?
    By Raeliean in forum C++ Programming
    Replies: 14
    Last Post: 07-27-2005, 03:41 PM
  4. You have to learn C in order to learn C++
    By gandalf_bar in forum A Brief History of Cprogramming.com
    Replies: 20
    Last Post: 07-16-2004, 10:33 AM
  5. Your stuff
    By smog890 in forum C Programming
    Replies: 6
    Last Post: 06-13-2002, 11:50 PM