Download presentation
Presentation is loading. Please wait.
1
Midterm Thursday, in class.
Cheat sheet only, close form, no electronics
2
Classes Event Handling GUI Components Variables, methods, constructors
Control structures Inheritance Access scope Event Handling GUI Components
3
Trace control structures – inclass exercise
Write control structure-related code – class sample Private, protected, and public - inclass exercise Write a simple class – Projects #1, #2 & #3 Concepts about Classes – Projects #1, #2 & #3 Concepts about Events and Event handling - Projects #2, #3 Concepts about GUI Components - Project #3
4
Examples CMyShape MyCar class (project #2) Re cap of class exercises
5
break & continue int sum=0; for (int i=1; i<=10; i++) { if (i%5==0) continue; sum += i; // sum = sum+i; } if (i%5==0) break;
6
What will be printed? for (int j=0; j<9; j++) { switch (i) {
for (int i=0; i<3; i++) { for (int j=0; j<9; j++) { switch (i) { case 0: break; case 1: continue; } Console::WriteLine(10*i+j); if (j==4) { else {
7
Access modifiers Public Private Protected
Accessible by external functions and methods Accessible to derived ref classes Private Not accessible by external functions and methods Not accessible to derived ref classes Protected
8
Are They Accessible? ref class B { private: int a; protected: int b;
public: int c; public: void bbb() { Console::Write(“{0}\n”, a); // accessible? Console::Write(“{0}\n”, b); // accessible? Console::Write(“{0}\n”, c); // accessible? } }; ref class A: public B { public: void bbb(int a) { Console::Write(“{0}\n”, this->a); // accessible? ref class C { public: void ccc() { B ^b = gcnew B(); Console::Write(“{0}\n”, b->a); // accessible? Console::Write(“{0}\n”, b->b); // accessible? Console::Write(“{0}\n”, b->c); // accessible?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.