Lecture Visual programming: Chapter 13 - Muhammad Bilal Zafar

The following will be discussed in this chapter: Design of a lexical-analyzer generator, the structure of the generated analyzer, pattern matching based on NFA's, DFA's for lexical analyzers, optimization of DFA-based pattern matchers, important states of an NFA. | LESSON 13 Overview of Previous Lesson(s) Over View Operator Overloading: Operator overloading is a very important capability, it enables to make standard C++ operators, such as + , - , * , and so on, work with objects of user defined data types. Following operators can’t be overloaded: 3 Over View Class Template A class template is not a class, but a sort of recipe for a class that will be used by the compiler to generate the code for a class. 4 Over View A pointer is a variable that stores the address of another variable of a particular type. long *pnum; //convention in C++ For getting the address & operator is used. This is a unary operator that obtains the address of a variable. It ’ s also called the reference operator. long number = 200; long* pnumber; pnumber = &number; 5 Over View 6 Operator & can be used to obtain the address of any variable, but you need a pointer of the appropriate type to store it. Over View Enumerations: enum class Suit{Clubs, Diamonds, Hearts, . | LESSON 13 Overview of Previous Lesson(s) Over View Operator Overloading: Operator overloading is a very important capability, it enables to make standard C++ operators, such as + , - , * , and so on, work with objects of user defined data types. Following operators can’t be overloaded: 3 Over View Class Template A class template is not a class, but a sort of recipe for a class that will be used by the compiler to generate the code for a class. 4 Over View A pointer is a variable that stores the address of another variable of a particular type. long *pnum; //convention in C++ For getting the address & operator is used. This is a unary operator that obtains the address of a variable. It ’ s also called the reference operator. long number = 200; long* pnumber; pnumber = &number; 5 Over View 6 Operator & can be used to obtain the address of any variable, but you need a pointer of the appropriate type to store it. Over View Enumerations: enum class Suit{Clubs, Diamonds, Hearts, Spades}; This defines an enumeration type, Suit , and variables of type Suit can be assigned only one of the values defined by the enumeration, Hearts , Clubs , Diamonds , or Spades. Suit suit = Suit::Clubs; This statement assigns the value Clubs from the Suit enumeration to the variable with the name suit . 7 Over View Reading Key Presses. AS we see earlier that Console::ReadKey(true); is used to store the result in the variable keypress, which is of type ConsoleKeyInfo. Lets have a look into an example which uses Readkey() and do while loop in CLR programming. Task: Continue to Press a key until Escape key is pressed. 8 TODAY’S LESSON 9 Contents Using Classes Defining a Problem Implementing the CBox class Comparing CBox Objects Combining CBox Objects Analyzing CBox Objects CLR Programming Nested If Statements Reading Key Presses For each Loop Tracking Handles 10 Using Classes Until now we have touched on most of the basic aspects of defining a native C++ class. So now we should look at .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.