Can we alias a class name the way we do in namespaces?
For example:
namespace longname{ }
namespace ln = longname;// namespace aliasing
class LONGNAME {};
class LN = LONGNAME; // how to do class name aliasing, if allowed?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Simple:
Typedefs are used in C++ a bit like “variables which can store types”. Example:
By using
Car::WheelCollectioneverywhere instead ofstd::vector<Wheel>, you can change the container type in one place and have all your code reflect the changes. This is the C++ way to abstract data types (whereas eg. in C# you’d have a property returningIEnumerable<Wheel>).