forked from zhmzhen/candcppCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcppTestAssem.cpp
More file actions
36 lines (36 loc) · 789 Bytes
/
cppTestAssem.cpp
File metadata and controls
36 lines (36 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>
#include <string>
#include <memory>
class CFXV {
virtual long add_p(long a, long b)=0;
};
class CFXC : public CFXV {
public:
long add_p (long a, long b) override {
return (a+b);
}
long return_md() const {
return md_;
}
private:
long md_ = 18;
};
class CFXD : public CFXV {
public:
long add_p (long a, long b) override {
return (a+b+2);
}
long return_md() const {
return mdd_;
}
private:
long mdd_ = 19;
};
int main () {
std::cout << "Hello Cliff Fuxuan Chen\n";
auto cfxc_shared = std::make_shared<CFXC>();
std::cout << cfxc_shared->return_md() << std::endl;
auto cfxd_unique = std::make_unique<CFXD>();
std::cout << cfxd_unique->return_md() << std::endl;
return 0;
}