examples/after/example_classes.h
changeset 5 29cf076edbda
parent 0 fe474e3b08fb
equal deleted inserted replaced
4:c0296ad2454d 5:29cf076edbda
    21 	
    21 	
    22 	private:
    22 	private:
    23 	int iA;
    23 	int iA;
    24 	int iB;
    24 	int iB;
    25 	};
    25 	};
       
    26 
       
    27 
       
    28 //Use the keyword "Typename" when using an initialiser that has been Typedef'd inside a class template
       
    29 //
       
    30 
       
    31 template <class T>
       
    32 class list {
       
    33 	public:
       
    34 	typedef unsigned int myType;
       
    35 	myType setSize (unsigned int x, unsigned int y);
       
    36 	};
       
    37  
       
    38 template<class T>	
       
    39 inline  typename list<T>::myType list<T>::setSize (unsigned int x, unsigned int y){  //This line will NOT throw the error
       
    40          return (x*y);
       
    41 	};
       
    42 
       
    43 
       
    44 //use \x to specify the character code directly
       
    45 
       
    46 char* literals()
       
    47    {
       
    48    char* string = "123\x7e456";     // use \x to specify the character code directly
       
    49    return string;
       
    50    }
       
    51