1 void DoSomething (const Foo & foo) void DoSomething(Foo foo)? , Foo ( ). , const + , . , const + and const?
# " ", , ++.
:
Foo ,Foo , ,- ,
const - , , , , ...
2 , , , - .
- ? , , (, Foo (Person & p)), ++ ? , ++ Contructor (string str): strMemberVariable (str) {}...
this, . , -.
Konrad: , this , this () , . ;)
3 , ++?
. , () .
FredOverflow, :
void fun(int* p, size_t size);
int main(int argc, char* argv[])
{
int array[15];
fun(array, 15);
}
, fun, , , array, array 15 : , .
array :
void changer(int*& array, size_t& size);
, ( ). , , , .
4 Foo fInstance Foo?
. Foo. Foo , , , . , 1, . , Foo Foo, :)?
:
class Foo
{
public:
private:
std::unique_ptr<Foo> mInstance;
};
, , :)