examples/before/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 // Correct refenrencing of types defined inside a class Template
       
    29 // Symptom GCC : Error: Expected initializer before ' (class name)' 
       
    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  list<T>::myType list<T>::setSize (unsigned int x, unsigned int y) //This line will throw the error
       
    40 
       
    41 	{  
       
    42          return (x*y);
       
    43 	};
       
    44 
       
    45 
       
    46 
       
    47 // Need to use  \x to specify the character code directly
       
    48 char* literals()
       
    49    {
       
    50    char* string = "123£456";
       
    51 
       
    52    return string;
       
    53    }
       
    54 
       
    55