[ create a new paste ] login | about

Link: http://codepad.org/PoCejkIA    [ raw code | output | fork ]

saltheads - C++, pasted on Jun 12:
class CFoo {
public :
  CFoo(void);
  CFoo(int num);
  virtual ~CFoo();
  virtual void SetValue(int num);
  virtual int GetValue(void);
  virtual void Dump(void) const;
private:
  int m_num;
};

CFoo::CFoo(void) : m_num(0) { }
CFoo::CFoo(int num) : m_num(num) { }
CFoo::~CFoo() { }
void CFoo::SetValue(int num) { m_num = num; }
int CFoo::GetValue(void) { return(m_num); }
void CFoo::Dump(void) const { printf("%d\n",m_num);}

int main() {
  CFoo* foo = new CFoo();
  foo->SetValue(10);
  int n = foo->GetValue();
  printf("%d\n",n);
  delete foo;
  return 0;
}


Output:
1
10


Create a new paste based on this one


Comments: