Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Money : Pair
- {
- ...
- public override bool Equals(object obj)
- {
- Pair pair = obj as Pair;
- return first == pair.First && second == pair.Second;
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- Pair p2 = new Pair(4, 5);
- MyCollection mc1 = new MyCollection();
- mc1.Add(5, p2);
- Pair p3 = new Pair(8, 5);
- bool check = mc1.ContainsValue(p3);
- Money m1 = new Money(11, 22);
- mc1.Add(4, m1);
- check = mc1.ContainsValue(m1);
- bool findKey = mc1.ContainsKey(11);
- mc1.Print();
- Console.WriteLine(check + " " + findKey);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement