First programming interview (c++)

>first programming interview (c++)
>learn easy shit like fizzbuzz and gaussian sum like Jow Forums says
>Okay, user, implement and demonstrate a way to make a class final without using said keyword

NOOO IT WASNT SUPPOSED TO END LIKE THIS WHY DID YOU LIE TO ME

Attached: serveimage(4).jpg (540x511, 61K)

it's a trap

Attached: 1526292690875.jpg (333x293, 40K)

kys

Attached: __hakurei_reimu_touhou_drawn_by_space_jin__dd14c8fc58e85fd3a3a709e355156bb9.jpg (700x800, 115K)

replace all variables with getter functions that return the desired final value

???? Final means the class cannot be inherited

Just use immutable.

Do this without doing this - is the most stupid kind of test
It shows the interviewer has no experience in coming up with realistic, applicable questions

please don't glare at me, reimu
it will give you wrinkles

Attached: 69b.jpg (707x1000, 175K)

That's how programmers who think outside the box are made.

>set constructors to private
well that was tough

Retard, now you can't instanciate that class.

How do you use it then?

Class Aux;
Class Final;

Class Aux
{
friend class Final;
private:
Aux(){}
};
class Final : private Aux
{};

God damnit, it's Class Final : virtual private Aux

How did you reply when they asked you that?

you don't think it's a real situation user?
that guy tries to get answers for his homework

>I don't spend my time learning bad practices of languages, my dude.

>Okay user you have to solve these 3 questions, we'll lock you in here for 8 hours while you do them, no internet ofcourse so we will take your cellphone
>O-o-okay

>Q1: Replace all letters in string with other string, essentially turning stuff into leetspeak, i.e R -> |2
>Np finish very quickly

>Q2: Find the inverse integer matrix
>Mfw I never did matricies at UNI
>Mfw the room had books on math though
>Find the answer to what the fuck they meant, solve it after awhile

>Q3: 20 targets are moving in linear direction and fixed speed, you have a fixed speed, what is the quickest time you can intercept them all including the time it takes for the target to walk back to 0,0 ?
>Oh and your solution has to do it in under a second on this shitty laptop
>I knew quadratic equations would become usefull one day
>Finish as they walk in the door

Last interview today, after 5 others, with the companies CEO, how will i drop the spaghetti do you think?

Attached: sweaty.gif (346x195, 2.66M)

I sat their cringing. He said "Hint: virtual. Inheritance."
I added a public method
virtual Shape inheritance(const Shape& x1)
and he just wiped the board in front of my face and started nodding.

Obviously you create public static Factory that produces said class instances

What does that have to do with quadratic equations?

What the fuck is the point of that?
Just to test if OP have heard about "final" before?

The interviewer never said it had to be usable.

Classes are usable when you put 'final'.

Calculating where you have to "Aim" to intercept a moving target.
I would honestly love to see if you have another solution since I was never 100% with my own.

Assume you can shoot a bullet at Bs speed and are standing and coordinates Bx, By
Assume the target is standing at target Tx, Ty and is moving at Tsx, Tsy speed.

>failing basic programming language question

at least you can fizzbuzz

And that's a bad thing. If you have to think outside the box it means the tools your using are bad.

>software engineering and architecture is bad
Huh...

This is the first time I have heard the term final as well.
I don't write java.

It's been introduced in C++11.

That's interesting, didn't know it. How did you inverse the matrix?

There's no reason to seal a class with final.

What if I don't want some chucklefuck shitting up my api?

I can see that.
Doesn't mean I ever had to use it.
It is much more important to be able to have a class that is extendable than having a class that isn't in my line of work.

Sealing your classes won't protect you from that.

fuck him up in the office with passive aggressiveness

close the pull request you cuck

Turns out there are just very fixed rules you can abuse for a 2x2 matrix (which was what the question was about, 2x2 only):
// Assuming matrix indicies as:
// ---------
// | 0 | 1 |
// |-------|
// | 2 | 3 |
// ---------

int determinant = inputMatrix[0] * inputMatrix[3] - inputMatrix[1] * inputMatrix[2];
int outputMatrix[4] = {determinant * inputMatrix[3], determinant * -1 * inputMatrix[1],
determinant * -1 * inputMatrix[2], determinant * inputMatrix[0]};

>using int for mathematical operations
Why?

Lol classic. None of you cucks actually know how to do it except that one user but you hurry to comment.

Why I was using an Int to do integer math is what you're asking?

I keep telling Jow Forums that they should learn more about OOP and stop jerking off over being able to code in C, but nobody ever listens.

haha cuck, mine was fizzbuzz
I had never done fizzbuzz in my life before
I did it something with if-else that might have worked, not sure, was pretty bad
got hired
php developer

fuck you

>implement and demonstrate a way to make a class final without using said keyword

CRTP base with private constructor and derived templated class friend.

shit, *virtual* CRTP base

Sorry, no re-dos, your answer was wrong. Yyyeah we'll call you, goodbye.

class MyClassDONOTINHERIT

wow that was hard