This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| namespace IntroToCSharpTute | |
| { | |
| class MyClass | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1) VS shows an error when there is more than one main function. | |
| 2) Static means the definition doesn't change. We dont want the program to change while it is running. | |
| 3) the using keyword is like the include statement in c++, it lets you use functions from other libraries and makes sure they are properly "disposed" of when the object goes out of scope. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| using System.IO; | |
| namespace IntroToCSharpTute | |
| { | |
| class Program |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1) | |
| *p3 = S | |
| *p3 = T, p3 = 6940 | |
| *p1 = S, p1 = 6940 | |
| 3) | |
| D | |
| 4) | |
| Type mismatch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1. | |
| Procedural is more centralised. Functions are given data to work with. | |
| OOP puts more data into the objects. Objects primarily only work with their own data set. | |
| 2. | |
| Abstraction: High level overview of an object. | |
| Encapsulation: cutting off direct access to preserve data integrity | |
| Inheritance: gaining data and attributes from parent objects | |
| Polymorphism: changing a child object to suit it's needs more accurately. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| const int m_NameLength = 32; | |
| struct Vector2 | |
| { | |
| float x; | |
| float y; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| const int m_NameLength = 32; | |
| struct Vector2 | |
| { | |
| float x; | |
| float y; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| const int m_NameLength = 32; | |
| struct Vector2 | |
| { | |
| float x; | |
| float y; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| const float m_LitresInAGallon = 3.78533f; | |
| void main() | |
| { | |
| float inputGallons = 0; | |
| std::cout << "Enter the number of gallons to convert to litres: "; | |
| std::cin >> inputGallons; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| void printHowManyTimes() | |
| { | |
| static int howManyTimes = 0; | |
| howManyTimes++; | |
| std::cout << "I have been called " << howManyTimes << " times." << std::endl; | |
| return; | |
| } | |
| void main() |
NewerOlder