Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!usc!samsung!uunet!timbuk!cs.umn.edu!kksys!edgar!mmug!p510.f22.n282.z1.mmug.edgar.mn.org!jspencer From: jspencer@p510.f22.n282.z1.mmug.edgar.mn.org (Jim Spencer) Newsgroups: comp.sys.mac.programmer Subject: Re: C/C++ difference? Message-ID: <1.27C1A4D4@mmug.edgar.mn.org> Date: 16 Feb 91 05:48:32 GMT Sender: ufgate@mmug.edgar.mn.org (newsout1.26) Organization: FidoNet node 1:282/22.510 - SmorgasBoard, Twin Cities Lines: 41 Rich Siegel writes in a message to All >>1) my think C manual says it is upwards compatable with c++, meaning >> think C is lacking something in c++. what exactly is it lacking? >C++ supports > o data abstraction the data needed by that code is local to that > code; if you want access to that data, you have to ask > the code ("object") to get it for you) >... RS> Actually, THINK C does support all three of these things; you RS> can write your own methods to abstract the instance variables RS> of an object. What THINK C does not provide is compiler-enforced RS> abstraction through the use of keywords such as "private", "protected", RS> and "friend". There's a couple of other C++ features that probably more directly relate to data abstraction than the data hiding you describe. C++ provides for operator and function overloading, i.e. it permits you to cause both operators and functions to work in new ways based on the type of the data being operated on or passed to the function. Thus if you are creating an abstract data type of type "complex" you can define a function which will describe what, say the '+' operator will do when it adds two complex numb ers and/or a complex number and an integer. Similarly, you can have two different functions named foo: foo(int); foo(double); and the correct function of the data type passed will be called. There are a few other things that Think C doesn't support that C++ does: - double slash comments - default arguments - constructors and destructors - the virtual keywords (effectively all Think C member functions are declared virtual. I think but am not sure that Think C does not support inline functions. -- Jim Spencer (jspencer@mmug.edgar.mn.org) UUCP: ...jhereg!tcnet!vware!edgar!mmug!jspencer FidoNet: 1:282/22.510 --