当前位置:网站首页>0x0fa23729 (vcruntime140d.dll) (in classes and objects - encapsulation.Exe) exception thrown (resolved)
0x0fa23729 (vcruntime140d.dll) (in classes and objects - encapsulation.Exe) exception thrown (resolved)
2022-07-07 10:22:00 【qq_ forty-two million one hundred and twenty thousand eight hun】
When running the program 42 That's ok Throw an exception , But I will cpp If the file is put under another solution, there will be no exceptions
#include<iostream>
#include<string>
using namespace std;
class Person
{
public:
// Set name
void setName(string name)
{
m_Name = name;
}
// Get name
string getName()
{
return m_Name;
}
// For age
int getAge()
{
//m_Age = 0; // The initialization age is 0 year
return m_Age;
}
void setAge(int age)
{
if (age < 0 || age > 150)
{
m_Age = 0;// Output error value , Set the age to 0
cout << " The age you entered is incorrect !" << endl;
return; // Exit the current function setAge()
}
m_Age = age;
}
// Set lover
void setLover(string lover)
{
m_Lover = lover;
} //***** There is an exception here ******
private:
string m_Name;// full name Can read but write
int m_Age; // Age Can read but write
string m_Lover; // Lover Just write
};
int main(void)
{
Person p;
// Set lover
p.setLover(" Bridge ");
//cout << " Lover for :" << p.getLover() << endl; // error , Because I didn't get a lover Function of getLover()
system("pause");
return 0;
}
Solution : Put the source file under several cpp After the file is set to exclude from generation , Compile and run again without throwing exceptions , I don't know why , May be able to understand with the deepening of learning .
边栏推荐
- China's first electronic audio category "Yamano electronic audio" digital collection is on sale!
- Interface test
- Some test points about coupon test
- SolidWorks工程图中添加中心线和中心符号线的办法
- Remote meter reading, switching on and off operation command
- [ORM framework]
- 网上可以开炒股账户吗安全吗
- Web3.0 series distributed storage IPFs
- Chris LATTNER, the father of llvm: why should we rebuild AI infrastructure software
- Some thoughts on the testing work in the process of R & D
猜你喜欢
ORM--分组查询,聚合查询,查询集QuerySet对象特性
Programming features of ISP, IAP, ICP, JTAG and SWD
Official media attention! The list of top 100 domestic digital collection platforms was released, and the industry accelerated the healthy development of compliance
虚数j的物理意义
【HigherHRNet】 HigherHRNet 详解之 HigherHRNet的热图回归代码
反卷积通俗详细解析与nn.ConvTranspose2d重要参数解释
Win10 installation vs2015
ORM -- query type, association query
mysql插入数据创建触发器填充uuid字段值
The new activity of "the arrival of twelve constellations and goddesses" was launched
随机推荐
ORM--数据库增删改查操作逻辑
Vs code specifies the extension installation location
Interface test
XML configuration file parsing and modeling
[learning notes - Li Hongyi] Gan (generation of confrontation network) full series (I)
网上可以开炒股账户吗安全吗
嵌入式工程师如何提高工作效率
【STM32】STM32烧录程序后SWD无法识别器件的问题解决方法
STM32 ADC and DMA
Video based full link Intelligent Cloud? This article explains in detail what Alibaba cloud video cloud "intelligent media production" is
Guid主键
Kotlin实现微信界面切换(Fragment练习)
【acwing】786. 第k个数
Es classes and objects, prototypes
【华为机试真题详解】高矮个子排队
HAL库配置通用定时器TIM触发ADC采样,然后DMA搬运到内存空间。
CONDA creates virtual environment offline
Pdf document signature Guide
A wave of open source notebooks is coming
Postman interface test V