Witam!
Otóż potrzebuje pomocy i to szybko z prostym programikiem. Więc tak są dwie klasy - Pojazd i Samochod. Klasa Pojazd jest dziedziczona przez Samochod.
Napisałem coś takiego i nie działa proszę o pomoc:
Kod:
#include<iostream>
#include<cstring>
using namespace std;
class Pojazd {
protected:
string Producent;
int Pasazerowie;
public:
Pojazd(string Producent, int Pasazerowie) {
this-> Producent = Producent;
this-> Pasazerowie = Pasazerowie;
}
string getProducent(){
return Producent;
}
int getPasazerowie() {
return Pasazerowie;
}
};
Kod:
#include<iostream>
#include<cstring>
#include "Pojazd.cpp"
using namespace std;
class Samochod : public Pojazd {
string Nadwozie;
int MPredkosc;
int APredkosc;
public:
Samochod(int MPredkosc, int APredkosc, string Nadwozie):Pojazd("",1) {
this->MPredkosc=MPredkosc;
this->APredkosc=APredkosc;
this->Nadwozie=Nadwozie;
}
string getNadwozie() {
return Nadwozie;
}
int getMPredkosc(){
return MPredkosc;
}
int getAPredkosc() {
return Pasazerowie;
}
void setAPredkosc(int APredkosc) {
this->APredkosc=APredkosc;
}
};
|
Uwaga: To jest stary temat Ta dyskusja jest starsza niż 90 dni. Informacje w niej zawarte mogą już nie być aktualne |
|
Znajdziesz nas na: