user705414
user705414

Reputation: 21200

Anyone can let me know the following syntax in C++?

Why we can access value_type by myType::value_type, any c++ reference talk about it?

class myType{ 
public:
   typedef double value_type; // the type for elements in the array
   private:
};

Upvotes: 0

Views: 102

Answers (1)

James Kanze
James Kanze

Reputation: 153909

In your example, value_type is a member of myType. It's a name, and name lookup says that it will be found in myType. Whether the name resolves to a typedef, a variable, a function, or whatever can't influence name lookup, since you have to find the name first, to know what it means. (This is a simplification, and there are cases where the type affects lookup; where depending on the type of symbol found in a first lookup, a second lookup might occur.)

Upvotes: 1

Related Questions