c++ note point

#point
classType *pi; pi= new classType; or pi= new classType('x',123);  delete pi;

typedef int* intPtr ;  intPtr p; ==  int *p;

const int * p        p is not allow change *p value     int * const p   p is not allow change point
const int * const p  not allow change *p value and not change point

class::class(int i,float f):integ(i),floa(f){}  --initial area  use initial const variable

class instance ;                                --call no parameter  constructor  demo note don't add   ()

class instance ; instance = class();            --also call no parameter constructor obviously for a instance must be add ()

#Inherite  demo
#include<iostream>
#include<fstream>

using namespace std;

void say_hello(ostream & outs = cout)           --default use ostream if have some default parameter  those appear the part of tail
{
  outs<<"hello";
}

int main()
{
  ofstream fout;
  fout.open("1.txt");                            --must be open first
  say_hello(cout);
  say_hello(fout);
  fout.close();                                  --don't forget close
  return 0;
}

你可能感兴趣的:(c++ note point)