Download presentation
Presentation is loading. Please wait.
Published byGerald Parsons Modified over 8 years ago
1
Survey Results
2
● Overall, ~38% (mostly) correct responses.
3
Why This Stuff Matters ● You WILL be quizzed on this by potential employers, every single time. ● Things I have been asked: ● What is polymorphism? ● What is a Hash Value? ● What do you need to know to sort an object, and how would you do it? ● What does Java and C# have that C/C++ does not? ● How many classes can you inherit from? How many interfaces? ● Ect, ect...
4
Amazon Hyland Software
5
Activision/Bungie Havok
6
Polymorphism ● Polymorphism is a programming language feature that allows values of different data types to be handled using a uniform interface.
7
Polymorphism Example ICollidable MarioBrick ICollidable.Collide()
8
Inheritance ● Inheritance is a way to reuse code of existing objects, or to establish a subtype from an existing object, or both. Classes can inherit attributes and behavior from pre-existing classes called base classes. ● Abstract Classes
9
Inheritance Example Brick BreakableBrickQuestionBrick Brick.Break() implemented
10
internal abstract class Brick : ICollidable; IgameObject { internal Brick(PowerUP brickContents, Vector2 position) { // Stuff } #region IGameObject Implementation internal MarioGameObjectEnum GameObjectEnum { get {return MarioGameObjectEnum.Brick;} } #endRegion #region ICollidable Implementation internal Collide(MarioGameObjectEnum collisionType, DirectionEnum direction) { if(collisionType == MarioGameObjectEnum.Mario && direction == DirectionEnum.Up) { this.Break(); } #endRegion protected abstract Break(); // THIS IS WHERE INHERITANCE COMES IN }
11
Encapsulation ● Encapsulation is a way of organising data and methods into a structure by concealing the way the object is implemented. ● Prevents access to data other than those specified. ● Encapsulation guarantees the integrity of the data contained in the object. ● Encapsulation encapsulates future changes to one location.
12
Abstraction ● The process by which data and programs are defined with a representation similar in form to its meaning (semantics), while hiding away the implementation details. ● Code-By-Contract
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.