Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Clark Lin
StudyCpp
Commits
48df3400
Commit
48df3400
authored
Dec 01, 2022
by
Administrator
Browse files
add cpp and header separation sample
parent
6628424b
Changes
4
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
48df3400
...
...
@@ -7,5 +7,8 @@
# Include all cpp file under all folder
!**/*.cpp
# Include all h file under all folder
!**/*.h
# Include .gitignore itself
!.gitignore
\ No newline at end of file
!.gitignore
04.HandsOn/common/Setup.cpp
0 → 100644
View file @
48df3400
#include <iostream>
#include "Setup.h"
using
namespace
std
;
// 设定分辨率
void
Setup
::
setResolution
()
{
this
->
resolution_width
=
1920
;
// 从设定处取得
this
->
resolution_height
=
1080
;
// 从设定处取得
};
// 取得分辨率
int
Setup
::
getResolution
()
{
// 水平分辨率 X 垂直分辨率
return
this
->
resolution_width
*
this
->
resolution_height
;
};
\ No newline at end of file
04.HandsOn/common/Setup.h
0 → 100644
View file @
48df3400
#pragma once // 防止头文件被重复包含
#include <iostream>
using
namespace
std
;
// 用于存放各类设置
class
Setup
{
private:
// 水平分辨率
int
resolution_width
;
// 垂直分辨率
int
resolution_height
;
public:
// 设定分辨率
void
setResolution
();
// 取得分辨率
int
getResolution
();
};
\ No newline at end of file
04.HandsOn/main.cpp
0 → 100644
View file @
48df3400
#include <iostream>
#include "common/Setup.h"
int
main
()
{
Setup
s
;
s
.
setResolution
();
cout
<<
"Resolution: "
<<
s
.
getResolution
()
<<
endl
;
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment