<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>#include <iostream><br>struct Foo {<br>    int    x;<br>    void bar();<br>};<br>void Foo::bar() {//<<<<<< not declared in the class<br>    std::cout<<x;<br>}<br>int main(int argc,const char** argv){<br>    Foo    f;f.x=10;<br>    f.bar();<br>}<br><br><br>Could anyone comment how difficult it would be to modify my own build of clang to allow this to compile. (and provide pointers on which areas of the source to look at)<br><br>the motivation is to ease refactoring, and reduce the inconsistency between free functions and member functions. I find myself constantly alternating between them, and this article explains why..<br>http://www.drdobbs.com/cpp/how-non-member-functions-improve-encapsu/184401197<br><br>I realise many people familiar with OOP discipline would object to this in principle, but its interesting to see how 'rust' and 'go' work with  their 'open world' philosophy eg traits and implementations.<br><br>i wondered if it would break the language design to allow this - I would suggest Foo::bar above hasa the same acess rights as free functions . it seems like a simple idea, and it cant be so obscure as a solution to my 'itch' has appeared in go/rust<br>                                    </div></body>
</html>