fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Generator {
  5. public:
  6. virtual float getSample(int sample)=0;
  7. };
  8.  
  9. class Note {
  10. public:
  11.  
  12. Generator *generator; // THIS IS WHAT IS CAUSING ME TROUBLE
  13. Note(Generator *aGen){
  14. generator = aGen;
  15. }
  16. };
  17.  
  18. class Synth : public Generator{
  19. public:
  20. virtual float getSample(int sample);
  21. int varA;
  22. int varB;
  23. Synth(){
  24. varA = 5;
  25. varB = 8;
  26. }
  27. };
  28.  
  29.  
  30. float Synth::getSample(int sample){
  31. varA = sample;
  32. varB = 3;
  33.  
  34. return 0;
  35. }
  36.  
  37. class Track {
  38. public:
  39. Generator *generator;
  40. Track(){
  41. generator = new Synth();
  42. }
  43. };
  44.  
  45. int main() {
  46. cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
  47. Track track = Track();
  48. Note n = Note(track.generator);
  49. cout << "test" << endl;
  50. return 0;
  51. }
Success #stdin #stdout 0s 3028KB
stdin
Standard input is empty
stdout
!!!Hello World!!!
test