L17 - Classes 2

L17 - Classes 2 - Object Oriented Design Where do we stand...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Object Oriented Design Where do we stand now? • We’ve talked about classes and their definition – class definition in <classname>.h file • this defines the interfaces for the class – implementation of the methods in <classname>.cpp file • We’ve talked about constructors and destructors – default constructor and overloaded constructors – issues to consider when a class has a member that is dynamic – order of method invocation as a program runs (explored through a trace of what happens in an example using the point class last time) • We discussed copy constructors and saw an example
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Constructors: What Happens by Default If you do not define a constructor, the system will define a default constructor the default constructor is supposed to initialize all numeric types to 0, all pointers to null, and all Boolean types to false (but be careful – check that it really does this!) If you do define a constructor, yours will be used whenever an object of this type is instantiated – that is, whenever an object is declared or new or gcnew is called to create an object of this type If you provide a constructor that takes a nonvoid parameter, you must also provide a default constructor. objects of managed classes must always be declared as
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 11

L17 - Classes 2 - Object Oriented Design Where do we stand...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online