130 likes | 322 Vues
Survey Results. Survey Results. Overall, ~38% (mostly) correct responses. 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?
E N D
Survey Results Overall, ~38% (mostly) correct responses.
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...
Amazon Hyland Software
Activision/Bungie Havok
Polymorphism Polymorphism is a programming language feature that allows values of different data types to be handled using a uniform interface.
Polymorphism Example ICollidable ICollidable.Collide() Mario Brick
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
Inheritance Example Brick BreakableBrick QuestionBrick Brick.Break() implemented
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 }
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.
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