
Untitled
By: a guest on
Aug 1st, 2012 | syntax:
None | size: 0.44 KB | hits: 4 | expires: Never
C typedef and return types: how to get the compiler to recognize the return type created with typedef?
#include <iostream>
using namespace std;
class A {
typedef int myInt;
int k;
public:
A(int i) : k(i) {}
myInt getK();
};
myInt A::getK() { return k; }
int main (int argc, char * const argv[]) {
A a(5);
cout << a.getK() << endl;
return 0;
}
myInt A::getK() { return k; }
A::myInt A::getK() { return k; }