Visual Studio:跳转到某个类的成员函数处

前文: Visual Studio:断点测试项目代码

1、若要查看销毁 Cardgame 对象时发生的情况,请查看 Cardgame 类的析构函数。

  • 在菜单栏上,选择“视图” > “类视图”。
  • 在“类视图”窗口中,展开“Game”项目树并选择“Cardgame”类来显示类成员和方法 。
  • 打开“~Cardgame(void)”析构函数的快捷菜单,然后选择“转到定义” 。
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    2、修改Cardgame.cpp
#include "Cardgame.h"
#include <iostream>

using namespace std;

int Cardgame::totalParticipants = 0;

Cardgame::Cardgame(int players)
    : players(players)
{
    totalParticipants += players;
    cout << players << " players have started a new game.  There are now "
         << totalParticipants << " players in total." << endl;
}

Cardgame::~Cardgame()
{
    totalParticipants -= players;
    cout << players << " players have finished their game.  There are now "
         << totalParticipants << " players in total." << endl;
}

3、在菜单栏上,依次选择“生成” > “生成解决方案” 。

4、生成完成后,可以通过选择菜单栏上的“调试” > “启动调试”或选择 F5 键在调试模式下运行此解决方案。 程序在第一个断点处暂停程序。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值