Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- // RASPUNS: 100 200 :)
- //namespace PregatireExamen {
- // class Swaping {
- // public void swap(ref int x, ref int y) {
- // int a, b; a = x; b = y; swap2(ref a, ref b);
- // }
- // public void swap2(ref int a, ref int b) {
- // int temp; temp = a; a = b; b = temp;
- // }
- // static void Main(string[] args) {
- // Swaping n = new Swaping();
- // int a = 100;
- // int b = 200;
- // n.swap(ref a, ref b);
- // Console.WriteLine(a + " " + b);
- // }
- // }
- //}
- //--------------------------------------------CURS 10-11 Sem 12--------------------------------------------//
- // RASPUNS: 2, 123, bravo, 1 (exista si destructor pt B... se afiseaza "123"[0] = 1) (cand se cere abc se trimite cab-ul)
- //namespace Ex1 {
- // public interface A {
- // string abc { get; set; }
- // }
- // public class B : A {
- // string cab;
- // public string abc { get => cab; set => cab = value; }
- // public B() {
- // cab = "123";
- // }
- // public A A() {
- // Console.WriteLine(cab);
- // return (A)this;
- // }
- // ~B() {
- // Console.WriteLine(cab[0].ToString());
- // }
- // }
- // public class C : B {
- // public C() {
- // Console.WriteLine(this.abc[1].ToString());
- // }
- // }
- // public class Exercitiu1 {
- // static void Main(string[] args) {
- // var c = new C();
- // var ainB = c.A();
- // Console.WriteLine("bravo");
- // }
- // }
- //}
- // RASPUNS: 10 (a.Add nu face nimic)
- //namespace Ex2 {
- // public class A {
- // public int nr { get; set; }
- // public A(int a) {
- // nr = a + 3;
- // }
- // public void Increment() {
- // nr++;
- // }
- // public void Add(int a) {
- // a += a;
- // }
- // public override string ToString() {
- // return (nr + 1).ToString();
- // }
- // }
- // public class Exercitiul2 {
- // static void Main(string[] args) {
- // var a = new A(5);
- // a.Increment();
- // a.Add(3);
- // Console.WriteLine(a);
- // }
- // }
- //}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement