Skip to content

Instantly share code, notes, and snippets.

@talreg
Created July 17, 2020 22:11
Show Gist options
  • Save talreg/080a4de3c0355494c7aa51bd4aabbea7 to your computer and use it in GitHub Desktop.
Save talreg/080a4de3c0355494c7aa51bd4aabbea7 to your computer and use it in GitHub Desktop.
#include<iostream>
using namespace std;
struct Test2
{
int value;
int get_value()const {
return value;
}
void inc_val(){
value++;
}
Test2(){
value=get_value();
}
};
int main(){
cout <<test2.get_value()<<endl;
const Test2* ptest2=new Test2(&test1);
ptest2->get_value();
ptest2->inc_val();
Test2* const ptest22=new Test2(&test1);
ptest22->inc_val();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment