Message from C, C++ talks

July 2019

— When spaces are removed, it worked. Thanks a lot

— #notename

— 👍

— #noendl

— 

Have a look at these :
https://m.youtube.com/watch?v=6WeEMlmrfOI
https://m.youtube.com/watch?v=GMqQOEZYVJQ

— Guys
If I have:


struct base{
virtual ~base(){}
};

struct derive : base{};

And I have the following function:

template<typename T>
void foo(T* t){/*some code*/}


so
In main:
I called foo first with an instance of base*

foo(new base);

Now, one of the foo instances is:
void foo(base* t)
Call this instance A.

Again I called foo again with instance of derive*:

foo(new derive);

Now, the question is:
Does the second call of foo refers to a new instance of foo function like:
void foo(derive* t){/***/}

or it just refers to the first instance A and we have a runtime polymorphism?!!

Message permanent page

— It's a different instance, they're generated at compile time

— New instance. The templates are expanded at compile time and you'd end up with the two foo's you listed

Message permanent page

— Welcome

— Got it

— Thanks

— It may be even more if you mix (non)const vars

— Guys i was solving this problem of largest contiguous sub array sum. And my friend asked this question, you have to select an integer X from the array A then square it and then return the sum of the subarray that has maximum sum over all subarrays of the resultant array. Sum of subarrays is the sum of all integers in subarray. How to tackle this problem

Message permanent page

— ANYONE HERE WHO IS EXPERT IN C OR ANY LANGUAGE

— YEEEEEEEEEEEEEEEEEEEEEEEES!!!!