Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///---main.cpp---\\\
- #include<iostream>
- #include<conio.h>
- #include"write.h"
- #include"load.h"
- #include"show.h"
- void main()
- {
- CNapisz* pNapisz = new CNapisz;
- CWczytaj* pWczytaj = new CWczytaj;
- CPokaz* pPokaz = new CPokaz;
- std::string Name;
- pNapisz->Pokaz();
- pWczytaj->Wczytaj();
- Name = pWczytaj->PokazDane();
- pPokaz->Pokaz(Name);
- getch();
- }
- ///---write.h---\\\
- #include<iostream>
- #include<conio.h>
- class CNapisz
- {
- public:
- CNapisz() { };
- virtual void Pokaz();
- };
- ///---write.cpp---\\\
- #include"write.h"
- void CNapisz::Pokaz()
- {
- std::cout << "Podaj swoje imie!" << std::endl;
- }
- //---load.h---\\\
- #include<iostream>
- #include<conio.h>
- class CWczytaj
- { private:
- std::string m_sName;
- public:
- CWczytaj() { };
- virtual void Wczytaj();
- virtual std::string PokazDane() { return m_sName; };
- };
- ///---load.cpp---\\\
- #include<iostream>
- #include<conio.h>
- #include<string>
- #include"load.h"
- void CWczytaj::Wczytaj()
- {
- std::cin >> m_sName;
- }
- ///---show.h---\\\
- #include<iostream>
- #include<conio.h>
- class CPokaz
- {
- public:
- CPokaz() { };
- virtual void Pokaz(std::string sName);
- };
- ///---show.cpp---\\\
- #include<iostream>
- #include<conio.h>
- #include<string>
- #include"show.h"
- void CPokaz::Pokaz(std::string sName)
- {
- std::cout << "Hello World!" << std::endl;
- std::cout << "Twoje imie to " << sName << "!" << std::endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement