• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1634
  • Last Modified:

learning c++

I would like to learn C++ by reading some simple C++ programs, any sources of simple C++ programs?
do you think it is a good method of learning C++?
I have some experience in programming already.
1 Solution
Based on my experience, If you know Object Oriented Concepts, then you can learn C++ by reading some simple C++ code. I strongly suggest you to go through Object Oriented concept before you start learning C++. Object Oriented Analysis and Design by Mr. Grady Booch is an excellent book.

You could try www.codeguru.com for c++ programs.
The best way to learn C++ is to first learn what this tool was developed for and that Is Object Oriented prorgramming. C++ is a tool in which was developed to implement object oriented programming. OO is much different from old style functional programming, the advantages are many.

In my opinion, I would start off with a book (Pick one, there are many out there ) that not only talk about the symantic and syntax of C++, but also dive into the concept of OO.  Work through the tutorials in the books and do your best to understand what is going on in the code snippets that are provided.

There is no such thing as learning C++/OO in 12 days or less, so don't believe it. And no I don't think that simply looking through the code of a C++ program is a good way to learn it because you may be looking at C++ code that did not take advantage of the actual OO capabilities of the language.

HI Stanleyhuen !!!
   I suggest u read this book carefully that's enough for u to start
a)Balaguruswamy C++
b)C++ by Eric Nagler
c) C++ by Herbert Schield
d)C++  by Bjarne Stroustop

some of the sites
7)http://www.elj.com/eiffel/ij/inheritance/virtual-fns/ -->explanation on virtual functions
8)http://www.elj.com/eiffel/ij/inheritance/polymorphism/ -->explanation on virtual functions
9)http://www.deakin.edu.au/~agoodman/ctutorial/819.html -->good part C & C++ tutorial
10)http://www.deakin.edu.au/~agoodman/ctutorial/ -->good part C & C++ tutorial
11)http://www.faqs.org/faqs/C++-faq/part6/ -->read marshall Cline's FAQ

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

> C++ is a tool in which was developed
> to implement object oriented
> programming

OO is not the only way to use C++.  According to Bjarne Stroustrup (and if he doesn't know, who does):

'C++ was designed to support data abstraction, object-oriented programming, and generic programming in addition to traditional C programming techniques'  (from C++ Programming Language, 3rd Edition).

I also think that it is possible to start to learn the language before you know much about OO - depending on what you want to do with the language.  A lot of people learn best by 'getting their hands dirty' first, and then going back to learn theory/related topics.

BTW, I think an excellent new C++ book is Stanley Lippmans Essential C++ (http://cseng.aw.com/bookpage.taf?ISBN=0-201-48518-4&ptype=0&catpage=&ctype=series&seriesid=43) - breaks the mould of recent C++ books, only about 300 pages for a start.
Not sure anyone said that OO was the only way to use C++. What was said was that if you want to learn C++ then you should learn why it was developed so that you may better understand the constructs of the language. Otherwise, why learn it at all, just stick with C.

Oh, and by the way data abstraction is one of the advantages of Object Oriented programming, and the ability to use a C++ compiler with our old C code was for backwards compatibility so that we could continue to use our old C programs.

> Oh, and by the way data abstraction
> is one of the advantages of Object
> Oriented programming

true, but you can have data abstraction without OO, read the 1st chapter of the C++ programming language.  

It is your premise that C++ was designed only for OO that I am contesting.  Bjarne Stroustrup clearly says that this was only one of several possible programming paradigms, and of those listed only 'C' style procedural programming is supported by C.

The Standard Template Library is a fine example of Generic Programming.  It has nothing much to do with OO,  but I think you would have severe trouble implementing it in C or even Java for that matter.
I stated that C++ was primarily developed to include tje constructs that make it possible to write an Object Oriented program. I did not state that this is the only way the language can be used.

When it boils down to compile time, templates turn into classes with what ever type you specified in your code, so templates are a C++ construct to assist in the implementation of OO and help the programmer take advantage of code reuse.

Anyway, two different views, we could go on and on and on. Even those guys that sit around and write books have different view points. Charels Petzold is one Author/Developer that i enjoy reading.

I also except your view point and think that it has good merit. I just hope the stanleyhuen gets his question answered.


> so templates are a C++ construct to
> assist in the implementation of OO
> and help the programmer take
> advantage of code reuse.

like I said, the standard template library has almost nothing to do with OO in its design/concepts.  But it has an awful lot to do with templates.  Templates are not really an OO concept, hence most OO languages do not support them (Java, Smalltalk etc.).  

> When it boils down to compile time,
> templates turn into classes with what
> ever type you specified in your code

there need be no C++ classes involved in template code.  Find the classes in this (apart from the iostream classes):

#include <iostream>

using namespace std;

template <typename Iterator, typename T>
Iterator find(Iterator begin, Iterator end, const T& value)
    while (begin != end && *begin != value)
    return begin;

void main()
    int container[] = { 1, 2, 3, 4, 5 };

    int* begin = container;
    int* end = container + 5;

    int* pos = find(begin, end, 3);

    if (pos != end)
        cout << "Found at position " << pos-begin << endl;
        cout << "Not Found!" << endl;

Who said anything about templates having anything to do with OO concepts, I said they are a C++ construct that assist in the implementation of creating generic classes, thus giving programmers one out of many ways of taking advantage of code reuse.

I do agree that templates can be used to implement more than just generic classes. But, even in your example, the template encapsulated the functionality of the specified data type. Back to the basics, an abstract data type is a data type that is defined along with the operations that can be performed on it. Abstract Data Types were one of the most basic concepts that lead to the final definition of a Class.

Ok, time for me to get back to work.

> Who said anything about templates
> having anything to do with OO concepts

your implication is that the only reason for having templates is to support OO programming.

Anyway, all I am really saying is that C++ is designed for more styles of programming than just OO.  Bjarne Stroustrup goes to considerable trouble to make this clear in The C++ Programming Language, and since he designed the language, he should have a good idea what the design intentions were.

(and you did say that "...tool was developed for and that Is Object Oriented prorgramming").
The best way is to read a complete C++ tutorial book and then use it to do programming.
The best to learn C++ is not to read some simple C++ program but to write, compile, run and then try to add some more functionality in that program.
Is this question going to get closed out?
learn C first... then moved to C++ and learn Object Oriented Programming. C++ is easy to learn since most of its built in functions are similar as C's functions. If you are using Turbo C/C++ IDE, then it's no need to further learn C++, just learn how to use iostream.h instead stdio.h...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now