P
Piotre Ugrumov
I have tried to write the class Student(Studente), Teacher(Docente). This
classes derive from the class Person.
In a class university(facoltà). I have tried to create an array of Student
and an array of Teacher, but the compiler give me an error. How can I do to
go on?
Here I have copied the Student, Teacher and University classes.
Thanks
Student class:
#pragma once
#include "persona.h"
#include "String.h"
class Studente :
public Persona
{
public:
Studente(String, String, String, int, long);
Studente(Studente &);
Studente(Persona, long);
long getMatricola();
void print();
~Studente(void);
protected:
const long matricola;
};
#include "StdAfx.h"
#include ".\studente.h"
#include <iostream>
using namespace std;
Studente::Studente(String nome, String cognome, String codfisc, int eta,
long matr)ersona(nome, cognome, codfisc, eta), matricola(matr)
{
}
Studente::Studente(Persona p, long matr)ersona(p), matricola(matr){
}
long Studente::getMatricola(){
return matricola;
}
Studente::Studente(Studente &s)ersona(s.nome, s.cognome, s.codFisc,
s.eta), matricola(s.matricola){
}
void Studente:rint(){
Persona:rint();
cout<<matricola<<endl;
}
Studente::~Studente(void)
{
}
Teacher class:
#include "StdAfx.h"
#include ".\docente.h"
#include <iostream>
using namespace std;
Docente:ocente(String nome, String cognome, String codfisc, int eta, int
as, int stipendio, long cod, String laurea, String insegnamento, String
ruolo):Impiegato(nome, cognome, codfisc, eta, as, stipendio, cod)
{
setLaurea(laurea);
setInsegnamento(insegnamento);
setRuolo(ruolo);
}
Docente:ocente(Impiegato i, String laurea, String insegnamento, String
ruolo):Impiegato(i){
setLaurea(laurea);
setInsegnamento(insegnamento);
setRuolo(ruolo);
}
void Docente::setLaurea(String lau){
laurea=lau;
}
void Docente::setInsegnamento(String ins){
insegnamento=ins;
}
void Docente::setRuolo(String ruo){
ruolo=ruo;
}
String Docente::getLaurea(){
return laurea;
}
String Docente::getInsegnamento(){
return insegnamento;
}
String Docente::getRuolo(){
return ruolo;
}
void Docente:rint(){
Impiegato:rint();
cout<<"Laurea conseguita: ";
laurea.print();
cout<<"Insegnamento: ";
insegnamento.print();
cout<<"Incarico (titolare o assistente): ";
ruolo.print();
}
Docente::~Docente(void)
{
}
University class:
#pragma once
#include "Docente.h"
#include "Studente.h"
class Facolta
{
public:
Facolta(String);
Facolta(int, int, int, String);
void setStudente(int, Studente);
void setDocente(int, Docente);
void setFacolta(String);
String getFacolta();
Studente getStudente();
Docente getDocente();
~Facolta(void);
private:
String facolta;
int ns, nd;
Studente *sPtr;
Docente *dPtr;
;
};
#include "StdAfx.h"
#include ".\facolta.h"
#include "Studente.h"
#include "Docente.h"
#include "Amministrativo.h"
Facolta::Facolta(String nome)
{
setFacolta(nome);
ns=0;
nd=0;
sPtr=NULL;
dPtr=NULL;
}
Facolta::Facolta(int s, int d, String nome){
setFacolta(nome);
nd=d;
ns=s;
sPtr=new Studente[ns];
dPtr=new Docente[nd];
}
void Facolta::setFacolta(String nome){
facolta=nome;
}
Facolta::~Facolta(void)
{
}
classes derive from the class Person.
In a class university(facoltà). I have tried to create an array of Student
and an array of Teacher, but the compiler give me an error. How can I do to
go on?
Here I have copied the Student, Teacher and University classes.
Thanks
Student class:
#pragma once
#include "persona.h"
#include "String.h"
class Studente :
public Persona
{
public:
Studente(String, String, String, int, long);
Studente(Studente &);
Studente(Persona, long);
long getMatricola();
void print();
~Studente(void);
protected:
const long matricola;
};
#include "StdAfx.h"
#include ".\studente.h"
#include <iostream>
using namespace std;
Studente::Studente(String nome, String cognome, String codfisc, int eta,
long matr)ersona(nome, cognome, codfisc, eta), matricola(matr)
{
}
Studente::Studente(Persona p, long matr)ersona(p), matricola(matr){
}
long Studente::getMatricola(){
return matricola;
}
Studente::Studente(Studente &s)ersona(s.nome, s.cognome, s.codFisc,
s.eta), matricola(s.matricola){
}
void Studente:rint(){
Persona:rint();
cout<<matricola<<endl;
}
Studente::~Studente(void)
{
}
Teacher class:
#include "StdAfx.h"
#include ".\docente.h"
#include <iostream>
using namespace std;
Docente:ocente(String nome, String cognome, String codfisc, int eta, int
as, int stipendio, long cod, String laurea, String insegnamento, String
ruolo):Impiegato(nome, cognome, codfisc, eta, as, stipendio, cod)
{
setLaurea(laurea);
setInsegnamento(insegnamento);
setRuolo(ruolo);
}
Docente:ocente(Impiegato i, String laurea, String insegnamento, String
ruolo):Impiegato(i){
setLaurea(laurea);
setInsegnamento(insegnamento);
setRuolo(ruolo);
}
void Docente::setLaurea(String lau){
laurea=lau;
}
void Docente::setInsegnamento(String ins){
insegnamento=ins;
}
void Docente::setRuolo(String ruo){
ruolo=ruo;
}
String Docente::getLaurea(){
return laurea;
}
String Docente::getInsegnamento(){
return insegnamento;
}
String Docente::getRuolo(){
return ruolo;
}
void Docente:rint(){
Impiegato:rint();
cout<<"Laurea conseguita: ";
laurea.print();
cout<<"Insegnamento: ";
insegnamento.print();
cout<<"Incarico (titolare o assistente): ";
ruolo.print();
}
Docente::~Docente(void)
{
}
University class:
#pragma once
#include "Docente.h"
#include "Studente.h"
class Facolta
{
public:
Facolta(String);
Facolta(int, int, int, String);
void setStudente(int, Studente);
void setDocente(int, Docente);
void setFacolta(String);
String getFacolta();
Studente getStudente();
Docente getDocente();
~Facolta(void);
private:
String facolta;
int ns, nd;
Studente *sPtr;
Docente *dPtr;
;
};
#include "StdAfx.h"
#include ".\facolta.h"
#include "Studente.h"
#include "Docente.h"
#include "Amministrativo.h"
Facolta::Facolta(String nome)
{
setFacolta(nome);
ns=0;
nd=0;
sPtr=NULL;
dPtr=NULL;
}
Facolta::Facolta(int s, int d, String nome){
setFacolta(nome);
nd=d;
ns=s;
sPtr=new Studente[ns];
dPtr=new Docente[nd];
}
void Facolta::setFacolta(String nome){
facolta=nome;
}
Facolta::~Facolta(void)
{
}