IntCell - { return storedValue; } { void setValue( int val...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
// IntCell.cpp / // Demonstrates default arguments in constructors, as well as // the explicit keyword to disable automatic conversions. // Updated 11/02/03 / class IntCell { public: //explicit // can be used to disallow auto conversions IntCell( int initialValue = 0 ) // default argument { storedValue = initialValue; } { int getValue( ) const
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { return storedValue; } { void setValue( int val ) { storedValue = val; } { private: int storedValue; }; } void main() { IntCell m1; IntCell m3( 55 ); I // C++ calls the single-parameter constructor // when making the following assignment: IntCell m2 = 37; I m1 = m2; m2.setValue( 40 ); m }...
View Full Document

This note was uploaded on 10/17/2010 for the course SCIS COP 4338 taught by Professor Kipirvine during the Spring '10 term at FIU.

Ask a homework question - tutors are online