This is a copy n paste of my earlier post that was a reply to a question about the difference between C and C++ and also about Visual C++ or windows programming. Its not exactly a tutorial but some information on C, C++ and Visual C++ that could be valuable for newbies learning these languages. Comments would be appretiated. So here it goes:
C is a Structured programming language. While C++ is an Object-Oriented Language. You can do a lot of stuff in C++ as compared to C.
Structured programming language i.e. C uses modules and functions that perform specific tasks like printing text, performing calculations etc. Functions make it easy for the programmer to divide his programs into a no. of tasks, thus making it easier to program. It uses the concept of divide and conquer. Functions can be either provided by the manufacturer of the compiler (pre-defined functions) or could be made by you (user-defined functions).
You can say that C is a go to less programming as it seldom uses go to statements. Most of the operations in C are done using the following constructs: Sequence, Selection and Repetition. Sequence is a step by step execution of program statements, Selection is the use of conditional execution like the well-known if statement (or functions in C) and Repetition is the repetition of a group of statements like in While statement and For statements.
Object-oriented programming languages (like C++) use the concept of re-usability of software or program components. You don’t have to re-invent the wheel. It uses the concept of information hiding, inheritance and polymorphism.
Like in C, C++ mostly uses pre-defined functions. It uses classes to hold data and functions. Data are states of the classes and functions are behaviors of the classes. Functions present in a class manipulate its data. Objects are instances (or implementations) of classes.
Classes communicate with one another so they provide that data to other classes that is necessary and hide the rest of the info. It is much like driving a car without knowing its internal working.
Inheritance allows one class to inherit some properties like data and functions from other classes. The class that inherits is called sub-class and its parent class (from which other classes inherit) is called the super class.
Polymorphism is one interface but many implementations. You can do a lot of stuff by giving one command. I think that’s all you need to know about polymorphism at this moment.
For programming in Windows you will have to use Visual C++. However you will need to learn C++ to use VC++. In MS-DOS and LINUX based programming the C++ program calls the operating system to get the user input and in Windows based programming the OS i.e. Windows issues messages whenever a user inputs something e.g. mouse clicks and button press etc for all of these special messages are sent to the C++ program. The messages sent by Windows are mapped in the C++ programs to perform a specific task using a the data received from the OS.
2006-07-23 23:03:27
·
answer #1
·
answered by Anonymous
·
1⤊
0⤋
Structured procedural programming is a way of analysing the task in terms of the steps that must be carried out to create the changes needed and output the resulting data in a useful format. It was the the way to design for a very long time and is still an important concept.
Object Oriented Programming (OOP for the geek in us all) is the newer way commonly used today. It tries to model the world as it is seen. A program that needs to deal with cars will have a "model" for a car that is produced from an object template called a class. Each car object may have an engine object, body style object and accessories package object, to name a few. By using instances of objects, which have both data and methods to manipulate it embeded in them, we have a more flexible model that can react differently if any part changes. Later, if we need a truck object, it can be easily derived from the code designed for the car program.
I hope this helps you understand a bit more about the differences on a small level.
2006-07-24 04:49:56
·
answer #2
·
answered by Anonymous
·
0⤊
0⤋
Lots of difference exist.
structured programs are programs written using languages like C, basic..etc. which need to be stacked on the whole for the program to function, it would include those headers, include files..
but OOP is lil different. you kind of see every thing as object. you tend to use objects only when u want it. and only then the objects get stacked over. else the are de-coupled.. less memory, more organised way..
everything is object here., Analysis in by objects, design the software using objects and even your language is object oriented.
C++, java, all .NET languages help u achieve that.
2006-07-23 23:16:32
·
answer #3
·
answered by juljulabie 3
·
0⤊
0⤋