Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // zwykla klasa
- class Klasa
- {
- int a,b;
- }
- //uzyta kompozycja - przyklad trywialny
- class Klasa
- {
- int a,b;
- string imie;
- }
- //inny przyklad
- class Author // twoja klasa z biblioteki
- {
- string imie, nazwisko;
- }
- // i teraz kompozycja
- class Book
- {
- Author autor_ksiazki; // tutaj tworzysz obiekt swojej klasy <- to jest kompozycja
- string title;
- }
- // w skrocie: wewnatrz tworzonej klasy tworzysz obiekt innej dowolnej klasy
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement