Sams Teach Yourself C in 21 Days

(singke) #1
Radius = 4, PI = 3.14159
The area is 50.3344

Summary ............................................................................................................


Today you covered the basics of object-oriented programming (OOP). You learned about
objects and the concepts that make up an object-oriented programming language—poly-
morphism, inheritance, encapsulation, and reuse. You have also seen that the basics of
the C++ programming language are exactly the same as the C programming language.
Additionally, you learned that Java is just another evolution of the C and C++ program-
ming languages. Over the next six bonus days, you will learn even more details on C++,
Java, and C#.

Q&A ....................................................................................................................


Q Why learn C if C++, Java, or C# does so much more?
AThe object-oriented constructs are a little more complicated to use. For the begin-
ner, C is an easy place to start because it is procedural, and thus it is easy to follow
the flow of the code. Because C++, Java, and C# are based on C, a lot of what you
have already learned will carry over if you move to one of these object-oriented
languages. If you are planning large and complex programs and want to have the
capability to reuse code and functionality, you should consider C++ or Java. If you
are using Microsoft .NET, you can consider C# as well as C++ and Java. If you are
going to be maintaining existing code, there is a good chance you’ll need to learn
C because there is a large amount of legacy C code in use.
Q How important is it to understand the object-oriented concepts?
AIt is essential. You must understand these concepts if you are to effectively use the
powerful tools of object-oriented programming languages. Don’t worry if you
don’t completely understand encapsulation, inheritance, and polymorphism right
away. As you work with C++, Java or C#, things will become clearer.

Workshop ............................................................................................................


The Workshop provides quiz questions to help you solidify your understanding of the
material covered and exercises to provide you with experience in using what you’ve
learned. Answers to the quiz are provided in Appendix F.

646 Bonus Day 1

OUTPUT

36 448201x-Bonus1 8/13/02 11:18 AM Page 646

Free download pdf