const_cast.cpp
Upload User: dq031136
Upload Date: 2022-08-08
Package Size: 802k
Code Size: 0k
Development Platform:

C++ Builder

  1. #include <stdio.h>
  2. class c {
  3.  public:
  4.   int j;
  5.    c(void) {j=10;}
  6.  };
  7. void PrintInt(const c* Object)
  8.  {
  9.   c* New = const_cast<c*> (Object);
  10.    New->j +=5;
  11.    printf("%dn", New->j);
  12.  }
  13. void main(void)
  14.  {
  15.   const c Sample;
  16.    PrintInt(&Sample);
  17.  }