compatibility

W. Tasin tasin at fhm.edu
Sun May 26 12:00:02 BST 2002


1) For the usage of class "string" you have to use
#include <string>

and not
#include <string.h>

BTW: you can/should also use #include <iostream>

2) more conforming to ANSI C++ is to use additionally:

using namespace std;

    or using

"std::string" for all "string" occurrences.

On my c++ library it isn't necessary, but it should be ;-)


3) And to get rid of a warning you have to define an empty _virtual_ 
destructor for your student-class.

So the example of your student class is like this:

#ifndef STUDENT_H
#define STUDENT_H

#include <string>
#include <iostream>
// is it really necessary ?
// #include <stdlib.h>

using namespace std;

class student
{
protected:
   string   studName;
   string   studSSN;
public:
   virtual void identify();
   student(string sName,string sSSN):studName(sName),studSSN(sSSN) {};
   virtual ~student() {};
};
#endif


Ryszard Klos wrote:

>I'm mostly using Borland C++ builder under Windows. Recently I've installed 
>Linux and I started using Kdevelop. I'm attaching five files main.cpp, 
>student.h, studend.cpp, studentAt.h and studentAt.cpp which are my Laboratory 
>assignment from college showing class inheritance and polymorphism. This 
>program compiles with no errors under C++ builder, under Kdevelop I'm 
>receiving quite a few (starting from syntax error ??). I wrote couple 
>programs for college using both compilers, up to this time I was able to 
>figure out difference necessary to make program compile in both environments, 
>but this time I have no clue where to start, because I don't see anything 
>wrong.
>If you may tell me where is the problem?
>I'd like to get better knowledge about Kdevelop to and try transfer my little 
>program supporting programming CNC mills to Linux environment.
>
>Sincerely,
>
>
>Ryszard Klos
>Ryszardklos at attbi.com
>Info at cncmilleditor.com
>

-- 
The KDevelop project: tasin at kdevelop.de [www.kdevelop.org]
--
oohhh sveglia.... il mondo e' ammalato, ma x colpa di chi.........
(Zucchero)
:-------W. Tasin, FB 04,FHM-------------------PGP-KeyID:0x7961A645----------:
<Key-Fingerprint: 1610 835F 0080 32F4 6140  6CF7 A7D0 44CD 7961A645>





-
to unsubscribe from this list send an email to kdevelop-request at kdevelop.org with the following body:
unsubscribe »your-email-address«



More information about the KDevelop mailing list