IT Community - Software Programming, Web Development and Technical Support

C and C++ differences

This is a discussion on C and C++ differences within the C and C++ Programming forums, part of the Software Development category; What are the difference of C and C++? Is it a good idea for me to learn even just the ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > C and C++ Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 03-20-2007, 09:26 PM
tripnautic tripnautic is offline
D-Web Programmer
 
Join Date: Mar 2007
Posts: 50
tripnautic is on a distinguished road
Default C and C++ differences

What are the difference of C and C++? Is it a good idea for me to learn even just the basics of C and C++ before I go to Java and other language?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 03-21-2007, 06:34 AM
Karpagarajan Karpagarajan is offline
D-Web Analyst
 
Join Date: Mar 2007
Posts: 299
Karpagarajan is on a distinguished road
Thumbs up Re: C and C++ differences

Hi,

The C++ is the advanced version of C language. I can just give you the sample program to understand the main difference between C and C++. The main different in C++ is the OOPS concept in it. OOPS is nothing but Opject Oriented Programming Structure.

The C Language is function oriented programming. Using this language there are lot of drawbacks, the main drawback is data security. Whereas in C++, the data will be based on the class & object oriented.

For example in C.

maint ()
{
int c;
}

where as in C++

class Sample:: private
{
private:
int c;
}


Sample sObject;
print sObject.c;

from the above sample program, you can understand how the variable "c" is secured by using in C++ language. If the class is declared as private it will be available only in the scope of declaration part.

C++ allows the programmer to create classes, which are somewhat similar to C structures. However, to a class can be assigned methods, functions associated to it, of various prototypes, which can access and operate within the class, somewhat like C functions often operate on a supplied handler pointer.

Although it is possible to implement anything which C++ could implement in C, C++ aids to standarize a way in which objects are created and managed, whereas the C programmer who implements the same system has alot of liberty on how to actually implement the internals, and style among programmers will vary alot on the design choices made.

Another one important thing is, Data Encapsulation.
Data encapsulation, sometimes referred to as data hiding, is the mechanism whereby the implementation details of a class are kept hidden from the user. The user can only perform a restricted set of operations on the hidden members of the class by executing special functions commonly called methods. The actions performed by the methods are determined by the designer of the class, who must be careful not to make the methods either overly flexible or too restrictive. This idea of hiding the details away from the user and providing a restricted, clearly defined interface is the underlying theme behind the concept of an abstract data type.

Hope you can carry on with any programming language which are implemented with OOPS concept, will be very useful.


thanks
__________________
Karpagarajan. R
Necessity is the mother of invention
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-23-2007, 02:39 AM
svarog svarog is offline
D-Web Trainee
 
Join Date: Apr 2007
Posts: 20
svarog is on a distinguished road
Default Re: C and C++ differences

C++ is an extention to C to support Object Oriented Programing.
There are some subtle differences beside that, but all of them are there to support OOP the best.

I would say you should start learning programming with Java, because Java is the only language that will require from you to program right.
Then, when you move to C/C++ you'll have much less bugs in your code
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Differences between a C++ struct and C++ class vijayanand C and C++ Programming 0 09-21-2007 03:35 AM
Can anybody explain about the differences between dataset.clone and dataset.copy? kingmaker C# Programming 2 08-28-2007 12:22 AM
Can anybody tell me Browser Differences in window.opener Behavior kingmaker HTML, CSS and Javascript Coding Techniques 2 07-24-2007 12:52 AM
differences between DIV and SPAN tag sivakumar HTML, CSS and Javascript Coding Techniques 1 07-11-2007 03:39 AM


All times are GMT -7. The time now is 04:13 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0