#include using namespace std ; //Abstract Class class Collection { public: virtual int getSize() = 0 ; virtual int getElement( int index ) = 0 ; void printElements() { int size = getSize() ; for( int i1=0 ; i1 < size ; i1++ ) { cout << getElement( i1 ) << " " ; } cout << endl ; } }; class Vector : public Collection { public: int getSize() { return 2 ; } int getElement( int index ) { if ( index == 0 ) return 100 ; else return 200 ; } }; int main() { Vector vectorObj ; vectorObj.printElements() ; return 0 ; }