我没有提出以下警告的解决方案:
main.cpp: In member function 'void MyClass::increase()':
main.cpp:350: warning: conversion to 'short unsigned int' from 'int' may alter its value
main.cpp中:
class MyClass {
public:
MyClass() : myShort(0) { }
void increase() { myShort *= 60; } // Line 350
private:
unsigned short myShort;
};
int main(int argc, char** argv)
{
MyClass myObj;
myObj.increase();
}