Ch Standard Demos
ISO C90 Standard
Wide characters
ISO C99 Standard
C++ features
Complex IEEE floating-point arithmetic
Assumed-shape arrays
Nested functions
Interactive C statement execution
Interactive command shell
Shell Programming
Safe Ch
Ch applets
String Type
Adjustable array bounds
Auto array bound checking
Socket/Winsock
POSIX
Unix utilities for Windows
Windows
GTK+
X/Motif
OpenGL
Toolkits Demos
CGI
ODBC
ChExcel
Ch Professional Demos
Computational array
Plotting
Numerical analysis
C LAPACK functions
Many complicated features in C++ are intentionally left out to retain the simplicity of Ch. The following C++ features are available in Ch:
  • Class.
  • Member function.
  • Mixed code and declaration.
  • The this-> pointer.
  • Reference type and pass-by-reference.
  • Function-style type conversion.
  • The private/public data and functions in class. Ch is compatible with C++ that by default, members of a class definition are assumed to be private until a `public' declaration is given.
  • Static member of class/struct/union.
  • The new and delete operators.
  • The constructor and destructor.
  • Polymorphic functions.
  • The scope resolution operator :: .
  • The I/O cout, cerr, cin with endl.
Ch supports classes in C++ with the following additional capabilities:
  • Classes inside member functions.
  • Nested functions with classes.
  • Pass member function to argument of pointer-to-function type of functions.
    #include <stdio.h>
    #include <new.h>
    #include <iostream.h>
    
    class tag{ 
        private:
           int m_i;
        public:
           tag(int i); 
           ~tag();
           int func(); 
    };
    
    tag::tag(int i) {
        cout << "i passed to tag::tag() is " << i << endl;
        m_i = i;
    }
    
    tag::~tag() {
        cout << "m_i in tag::~tag() is " << m_i << endl;
    }
    
    int tag::func() {
        printf("m_i in tag::func() is %d\n", m_i);
        return 0;
    }
    
    int main() {
        class tag s = tag(10);
        class tag *sp = new tag(20);
      
        s.func(); 
        sp->func(); 
        delete sp;
        return 0;
    }
    

    The output is:
    i passed to tag::tag() is 10
    i passed to tag::tag() is 20
    m_i in tag::func() is 10
    m_i in tag::func() is 20
    m_i in tag::~tag() is 20
    m_i in tag::~tag() is 10