{"comment":{"url":"https://api.github.com/repos/GordeyChernyy/DrawingTool/comments/14569432","html_url":"https://github.com/GordeyChernyy/DrawingTool/commit/61e633329325fe5d6450200661be8dd78c0b068a#commitcomment-14569432","id":14569432,"user":{"login":"anirudh-eka","id":2926126,"avatar_url":"https://avatars.githubusercontent.com/u/2926126?v=3","gravatar_id":"","url":"https://api.github.com/users/anirudh-eka","html_url":"https://github.com/anirudh-eka","followers_url":"https://api.github.com/users/anirudh-eka/followers","following_url":"https://api.github.com/users/anirudh-eka/following{/other_user}","gists_url":"https://api.github.com/users/anirudh-eka/gists{/gist_id}","starred_url":"https://api.github.com/users/anirudh-eka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anirudh-eka/subscriptions","organizations_url":"https://api.github.com/users/anirudh-eka/orgs","repos_url":"https://api.github.com/users/anirudh-eka/repos","events_url":"https://api.github.com/users/anirudh-eka/events{/privacy}","received_events_url":"https://api.github.com/users/anirudh-eka/received_events","type":"User","site_admin":false},"position":6,"line":73,"path":"src/ofApp.h","commit_id":"61e633329325fe5d6450200661be8dd78c0b068a","created_at":"2015-11-23T19:01:33Z","updated_at":"2015-11-23T19:01:33Z","body":"Ah, good question! I had to do some research on why this works. [Here](http://stackoverflow.com/a/15630151) is an explanation. \r\n\r\nI think basically `ofApp.h` is 'inheriting' the include of `BrushBase` from `TriangleBrush` and/or `DreamBrush`. In other words:\r\n\r\n`ofApp.h` includes `TriangleBrush`\r\n`TriangleBrush` includes `BrushBase`\r\ntherefore: \r\n`ofApp.h' can include `BrushBase`\r\n\r\nBased on the article I linked, though this works, it isn't the best way to do it. The author says we should include `BrushBase` directly into all header file that depends on it including `ofApp.h` and we should add gaurds (`#ifndef`) to our header files to prevent multiple inclusions. To see guards in action, checkout the `BrushBase.h` file. The general template for a guard is:\r\n```\r\n#ifndef MY_HEADER_H\r\n#define MY_HDEADER_H\r\n\r\n// code...\r\n\r\n#endif  // this file will only ever be copied in once to another file\r\n```\r\n"}}