Thread: C++ Tutorial Order Confusion

  1. #1
    Registered User
    Join Date
    Aug 2011
    Posts
    8

    C++ Tutorial Order Confusion

    The past few weeks I've been following the C++ tutorials at the cprogramming website in order (Clicking the "Next Tutorial: *name*" link at the bottom of each tutorial to go to the next one.)

    After tutorial number 20, there is no "Next Tutorial" button. That slightly confused me, so I went to the tutorial index, found the name of tutorial number 20, and clicked the one after it (Tutorial #20 is Inheritence Syntax in C++, and the one below it in the index is Initialization Lists in C++). I realized quickly that every tutorial after the Inheritence Syntax tutorial number 20 had stuff that flew way over my head, using terminology and syntax that I didn't understand at all. For example, in the Initialization Lists tutorial, part of the example code declares a variable of type "T":

    Code:
    template 
    class my_template
    {
            public:
                    // works as long as T has a copy constructor
                    my_template( T bar ) : _bar( bar ) { }
    
            private:
                    T _bar;      << What is that?
    };
    And in the next tutorial, C++ Class Design, the tutorial talks about declaring virtual and non-virtual functions. Neither of those concepts (T variables and virtual functions) mean anything to me.

    Can someone just explain the order that I read each tutorial in, starting right after tutorial #20?

    Thanks.

    EDIT: Just in case it isn't completely clear, the reason I don't understand either of those concepts, or several others that have appeared in other tutorials, is because the C++ Tutorials up to that point had not explained those to me yet, which is why I'm wondering if that is the right order to be reading the tutorials in.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    You should read the tutorial on templates in C++ to understand that part. Unfortunately, there appears to be a typographical error, possibly caused by importing the example into HTML. The first line should read:
    Code:
    template<typename T>
    This also explains what T is: a type name.
    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
    Aug 2011
    Posts
    8
    Okay thanks, I'll look at that tutorial. That helps me with the "T" variable.

    But is there anyone who can explain the order of the tutorials for me?

  4. #4
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,949
    Quote Originally Posted by Bonnet View Post
    But is there anyone who can explain the order of the tutorials for me?
    I believe the webmaster is the one who put the list together, perhaps he would be able to answer your question for you.
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

  5. #5
    Administrator webmaster's Avatar
    Join Date
    Aug 2001
    Posts
    1,012
    Thanks for the heads-up, that is definitely a mistake in the formatting. I've reordered the tutorials a little bit to try and make it better (so that initialization lists comes after templates, for example). Please let me know if you run into any other examples like this.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Confusion with * and &
    By Ganoosh in forum C++ Programming
    Replies: 32
    Last Post: 06-23-2005, 10:16 PM
  2. if,else if and else confusion...
    By diding in forum C Programming
    Replies: 5
    Last Post: 10-10-2004, 08:19 PM
  3. Confusion with DirectMusic tutorial
    By Hunter2 in forum Game Programming
    Replies: 0
    Last Post: 06-09-2003, 09:24 PM
  4. tutorial confusion <<endl;
    By ikke in forum C++ Programming
    Replies: 5
    Last Post: 05-22-2003, 08:39 AM
  5. c++ confusion
    By Goku-ssj in forum C++ Programming
    Replies: 12
    Last Post: 09-11-2002, 11:19 AM