Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <iostream>
- using namespace std;
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- class Notatka {
- protected:
- char *m_Tekst;
- public:
- Notatka(char *tekst)
- {
- m_Tekst = new char[strlen(tekst)+1];
- strcpy(m_Tekst, tekst);
- }
- Notatka(const Notatka& notka) //Notatka note1; Notatka note2(note1);
- {
- m_Tekst = new char[strlen(notka.m_Tekst)+1];
- strcpy(m_Tekst, notka.m_Tekst);
- }
- Notatka &operator =(const Notatka& notka) //Notatka note1; Notatka note2=note1;
- {
- if(m_Tekst)
- delete [] m_Tekst;
- m_Tekst = new char[strlen(notka.m_Tekst)+1];
- strcpy(m_Tekst, notka.m_Tekst);
- return *this;
- }
- virtual ~Notatka(){
- delete [] m_Tekst;
- }
- };
- class Zadanie : public Notatka {
- protected:
- int m_iWykonane;
- public:
- Zadanie (const Notatka& notatka, int wykon):Notatka(notatka) //Notatka note1; Zadanie zad1(note1, 2);
- {
- m_iWykonane = wykon;
- }
- };
- int main() {
- char cos[]="dgh";
- Notatka n(cos);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement