bene...anzi male...oggi ho provato a fare la mia prima classe in c++
vi riporto i codici :
Rational.h
codice:
#ifndef RATIONAL_H
#define RATIONAL_H
class Rational {
public:
Rational(int=1,int=1);
private:
int num;
int den;
}
#endif
Rational.cpp
codice:
#include "Rational.h"
Rational::Rational(int n,int d)
{
num=n;
den=d;
}
prova.cpp
codice:
#include "Rational.h"
void main() {
Rational a(2,3), b(3,4), c(1,5), ris;
}
mi dà i seguenti errori
codice:
C:\filec>bcc32 prova.cpp rational.cpp
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
prova2.cpp:
Error E2176 prova2.cpp 3: Too many types in declaration
Error E2111 prova2.cpp 3: Type 'Rational' may not be defined here
*** 2 errors in Compile ***
Rational.cpp:
Error E2111 Rational.cpp 3: Type 'Rational' may not be defined here
Error E2136 Rational.cpp 3: Constructor cannot have a return type specification
*** 2 errors in Compile ***
xchè?? :master: