Don't like ads? PRO users don't see any ads ;-)
Guest

data initialization list

By: a guest on Jun 1st, 2012  |  syntax: C++  |  size: 0.33 KB  |  hits: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. IntList::IntList(): Items(new int[SIZE]), numItems(0), arraySize(SIZE) { //data initialization list
  2.         //empty constructor body
  3. }
  4.  
  5. //O código acima equivale a:
  6. IntList::IntList() {
  7.         Items = new int[SIZE];
  8.         numItems = 0;
  9.         arraySize = SIZE;
  10. }
  11. //entretanto, a lista de inicialização de dados é executada antes do corpo do construtor