Skip to content

Instantly share code, notes, and snippets.

@ilkermanap
Created October 25, 2019 13:58
Show Gist options
  • Save ilkermanap/1c977efc17885688cf742a22df6e2f1a to your computer and use it in GitHub Desktop.
Save ilkermanap/1c977efc17885688cf742a22df6e2f1a to your computer and use it in GitHub Desktop.
#include "evler.h"
#include <iostream>
using namespace std;
Ev::Ev() {
tipi = "Ev";
}
Ev::Ev(uint oda_say) {
tipi = "Ev";
oda_sayisi = oda_say;
}
void Ev::rapor() {
cout << "Tip " << this->tipi << endl;
cout << "Oda sayisi " << this->oda_sayisi << endl;
cout << "Bahce " << this->bahce << endl;
cout << "------------------------" << endl;
}
Ciftlik::Ciftlik() {
tipi = "Ciftlik";
}
Ciftlik::Ciftlik(uint x) {
tipi = "Ciftlik";
oda_sayisi = x;
}
Daire::Daire() {
tipi = "Daire";
}
Daire::Daire(uint x) {
tipi = "Daire";
oda_sayisi = x;
}
#ifndef EVLER_H
#define EVLER_H
#include <string>
typedef unsigned int uint;
using namespace std;
class Ev{
public:
uint oda_sayisi;
float fiyat;
bool bahce=false;
bool teras;
bool havuz;
string tipi;
Ev();
Ev(uint); // oda sayisi vererek
void rapor();
};
class Ciftlik : public Ev {
public:
Ciftlik();
Ciftlik(uint); // oda sayisi ile
};
class Daire : public Ev {
public:
Daire();
Daire(uint); //oda sayisi ile
};
#endif
#include "evler.h"
int main() {
Ev ev(2);
Daire dr(4);
Ciftlik cf(8);
ev.rapor();
dr.rapor();
cf.rapor();
}
all:
g++ -c evler.cpp -std=c++11
g++ evler.o evmain.cpp -o evmain -std=c++11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment