admin 管理员组文章数量: 887090
2024年1月12日发(作者:条件语句python)
19 m_nHp = m_nHp < 0 ? 0 : m_nHp;//safe check20 } HeroView类: 1 #pragma once 2 class HeroView 3 { 4 public: 5 HeroView(); 6 ~HeroView(); 7
8 //show hero UI data; 9 void show(string no, string name,int att, int hp);10 //show hero dead UI;11 void dead(string no, string name);12 //show heor winned UI;13 void winned(string no, string name);14 private:15 //Hero* m_hero;16 };HeroView.h 1 #include "stdafx.h" 2 #include "HeroView.h" 3
4
5
6 HeroView::HeroView() 7 { 8 } 9
10 HeroView::~HeroView()11 {12 }13
14 void HeroView::show(string no,string name, int att, int hp)15 {16 cout << "Hero info:"<<"(no:"< 19 void HeroView::dead(string no, string name)20 {21 cout << "Hero Dead:" << "(no:" << no << ",name:"< 24 void HeroView::winned(string no, string name)25 {26 cout << "Hero Winned:" << "(no:" << no << ",name:" << name << ")" << endl;27 28 } HeroController类: 1 #pragma once 2 class HeroController 3 { 4 public: 5 HeroController(string no, string name); 6 ~HeroController(); 7 void setHeroHp(int hp);//set hero hp 8 void setHeroAtt(int att);//set hero att 9 void show();//show hero info10 void beAttack(int att);//be attacked by hero11 void dead();//dead12 void winned();//winned13 public :14 Hero* getHero() { return m_hero; }//get hero15 16 private:17 Hero * m_hero;//hero18 HeroView * m_heroView;//hero view
版权声明:本文标题:设计模式--MVC(C++版) 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.freenas.com.cn/free/1705046534h471088.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论