Initializing pointers in C++

Yes, you can initialize pointers to a value on declaration, however you can’t do: & is the address of operator and you can’t apply that to a constant (although if you could, that would be interesting). Try using another variable: or type-casting:

Is null reference possible?

References are not pointers. 8.3.2/1: A reference shall be initialized to refer to a valid object or function. [Note: in particular, a null reference cannot exist in a well-defined program, because the only way to create such a reference would be to bind it to the “object” obtained by dereferencing a null pointer, which causes … Read more

When/why to make function private in class?

You should make a function private when you don’t need other objects or classes to access the function, when you’ll be invoking it from within the class. Stick to the principle of least privilege, only allow access to variables/functions that are absolutely necessary. Anything that doesn’t fit this criteria should be private.

Finding the type of an object in C++

dynamic_cast should do the trick The dynamic_cast keyword casts a datum from one pointer or reference type to another, performing a runtime check to ensure the validity of the cast. If you attempt to cast to pointer to a type that is not a type of actual object, the result of the cast will be … Read more

Does WPF Work with C++?

You can use WPF with C++/CLI. It is a .NET API, however, so it requires the .NET Framework. That being said, the designer support is non-existent with C++. This means that, for practical purposes, WPF doesn’t really work with C++. Typically, the user interface layer is written in C# (or VB.NET), then calls into C++ … Read more

Friend methods error

I get this error message: My header has this line and in the cpp file it is like this. I searched but mostly it says that I need same class without friend but I tried, and it did not work. Can you please give me some suggestion? Thank you

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)