I'm back to C++ and little help is needed. I know what's const pointer, but I can find out, how to assign it in constructor properly That's frustrating ;)
so for example:
public:
TransferManager::TransferManager( Account * source, double amount )
{
account = source; // that doesn't work ;)
}
private:
Account * const account;
1>proj1.cpp(63): error C2166: l-value specifies const object
That error msg isn't clear for me.
I did some research, but all I did find was difference bettwen const pointer, pointer to const var, and const pointer to const var...
Use the initializer-list to initialize const members:
TransferManager::TransferManager( Account * source, double amount ) : account(source) {
}
The error message is saying that you're trying to assign to something that is const - that's not permitted. You have to initialize such member variables, not assign to them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With