Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ÖRÖKLÉS (Inheritance):
- class A {
- public void m1()
- {
- Console.Write("hello");
- }
- }
- class B : A
- {
- public void m2()
- {
- m1();
- }
- }
- class Program
- {
- static void Main(string[] a)
- {
- B b = new B();
- b.m2();
- }
- }
- ////////////////////////////////////////////
- // OBJEKTUMÖSSZETÉTEL (Object composition):
- class A
- {
- public void m1()
- {
- Console.Write("hello");
- }
- }
- class B
- {
- A a = new A();
- public void m2()
- {
- a.m1();
- }
- }
- class Program
- {
- static void Main(string[] a)
- {
- B b = new B();
- b.m2();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment