lect5 - Yin Lou CS 2026, Spring 2010 OO features...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Yin Lou CS 2026, Spring 2010 OO features Accessibility Virtual and Override Class members Properties Indexers Operators Function parameters ref, out Function params params keyword Iterators Advanced C# types Nullable types Partial types Generics Used in methods where the number of arguments is variable Only one params keyword can be used in a method No parameters defined after the params parameter C# Java public int SumGrades ( params int grades) { int sum = 0; for (int i=0; i<grades.length; i++) sum += grades[i]; return sum; } public int sumGrades (int grades) { int sum = 0; for (int i=0; i<grades.length; i++) sum += grades[i]; return sum; } Common programming pattern Allows you to walk through a collection of elements in a data structure Example Similar to Java foreach (string name in names) { Console.WriteLine(name); } for (String name : names) { System.out.println(name); }...
View Full Document

This document was uploaded on 03/15/2010.

Page1 / 17

lect5 - Yin Lou CS 2026, Spring 2010 OO features...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online