﻿
#include <iostream>
using namespace std;

// definicja klasy instrumentu muzycznego
class Instrument {
  public:
    Instrument();  // konstruktor bezparametrowy
    ~Instrument(); // destruktor
    void graj();   // metoda graj()

    string nazwa ; // pole nazwa
    string kolor;  // pole kolor
    int waga;      // pole waga
};

// definicja metody graj()
void Instrument::graj() {
    cout << "pięknie gram" << endl;
}

// definicja konstruktora bezparametrowego
Instrument::Instrument() {
    cout << "konstruktor bezparametrowy - buduję obiekt instrument w pamięci:" << endl;
    waga = 0;
    nazwa = "";
    kolor = "";
    cout << "waga: " << waga << "\nnazwa: " << nazwa << "\nkolor: " << kolor << endl;
}

// definicja destruktora
Instrument::~Instrument(){
    cout << "\ndestruktor niszczę obiekt instrument o nazwie "<< nazwa <<" w pamięci\n" << endl;
}

int main()
{
    cout << "tworzymy obiek klasy Instrument" << endl;
    Instrument gitara;

    cout << "\nnadajemy nazwę instrumentowi: gitara" << endl;
    gitara.nazwa = "gitara";
    
    cout << "nazwa instrumentu: " << gitara.nazwa << endl;
}


