Wednesday 18 January 2017

[Class Diagram] Association, Aggregation and Composition


Association: ... has a ...
ex. Professor has books and books belong to one professor.

Aggregation: ... owns a ...
ex. Department has many professors in it, and professors belong to many departments or belong to many schools.

Composition: ... is a part of ...
ex. University has many departments, and departments belong to one university. While University closed, departments won't be existed.

Sunday 15 January 2017

[C++] return by address/reference


 int *createArrayAddr(int n) {  
   int *a = new int(5);  
     
   cout << (void*) a << endl;  
     
   return a;  
 }  
   
 int &createArrayRef(int &n) {  
     
   cout << &n << endl;  
     
   return n;  
 }  
   
 int main(int argc, const char * argv[]) {  
   int *a = createArrayAddr(5);  
   cout << (void*) a << endl;  
     
   int n = 55;  
   cout << &n << endl;  
   int &n2 = createArrayRef(n);  
   cout << &n2 << endl;  
   
   return 0;  
 }  

RESULT:

 0x1001054d0  
 0x1001054d0  
 0x7fff5fbff7f4  
 0x7fff5fbff7f4  
 0x7fff5fbff7f4  

Thursday 12 January 2017

Your body language shapes who you are



Self-fulfill, faith, you believed in who you are, and you could be the one you want.

1-Bit Music from Tristan Perich

There's a composer named Tristan Perich composes his album as 1-bit music, more interested thing is when you get his CDs, there's no CD in it, you could just plug your ear phone in and listen to his music.

Try to listen to his CertainMovement in the 1st album.



















Refer http://www.1bitmusic.com/ to get to know him more.