Back
Close

quiz 72

Anonymous
1,233 views
#include <iostream>
struct mybase
{
int x;
template <int RANGE>
virtual void print()
{
std::cout << RANGE + x + 1 << std::endl;
}
};
struct myderived : public mybase
{
template <int RANGE>
void print()
{
std::cout << RANGE + x + 2 << std::endl;
}
};
int main(int argc, char** argv)
{
mybase* b = new myderived;
b->x = 1;
b->print<5>();
return 0;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants