/dpt/ - Daily Programming Thread

No meme shitters edition

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

tutorialspoint.com/d_programming/d_programming_classes_objects.htm
wiki.qt.io/Qt_Based_Games
twitter.com/SFWRedditGifs

I love C++!

Is it just a coincidence that most OOP supporters are extremely stupid?

Gatekeeper please kill /dpt/

/dpt/ spreads memes and misinformations to newfags. /dpt/ has no practical knowledge of programming. Sup Forums is not designed to have a meaningful debate anyway

>No meme shitters edition

c++

x::x() : y()

What does the : do here?

Sorry for shitting up last thread, the gatekeeper is hilarious to me and also it was near bump limit anyways. It's all out of my system now.

Java is the most powerful language!

Create confusion

>memes
>meme
What is that? Is that what they use for "OOP"

>memes
Try using >meme
Try >games
Use

Re-implementing Rust without the BC.

Depends on the context. If you're declaring x::x, then the call to y initializes either a member or a base object. On the other hand, x might be a static member function of x which you're calling in a ternary conditional, and y() would be the else clause.

looks like a ctor for x that default initializes a member y, but can't say for sure without more context. Shouldn't there be curly braces, anyway?

>shilling for on How much do they pay you?

Godspeed. Please drive away the last remaining programmers ITT and start posting anime and lgbt memes

/dpt/ - Designated Pajeet Thread

Dead programming thread

>meme
I don't want reddit stink nearby.
Seriously: piss off. Your kind is not welcome here.

Are you a bot?

Please user, for the sake of everybody: just kill yourself.

To the autist who keeps linking to Sup Forums, please kill yourself. You derail every one of these threads.

Can you tell me what 15 + 13's double is?

>If you're declaring x::x, then the call to y initializes either a member or a base object.

So you can create a method for a class without prototyping it in the class?

Also a little more clarification
x::x() : y() {

}

Also what would
x::x() : y(), z() {

}

be doing?

def apriorigen(l, k):
c = set()
for a in l:
for b in l:
if len(a | b) == k-1:
c.add(union)

return c


Why can't I do this i python
Python is so shit

>object
I don't want your reddit stink nearby, fuck off

>Python
>>>/wdg/

/dpt/ why can't C do fucking anything right? Why does anyone shill this garbage language?
/* Create a new class union (like namespaces) to keep this class in. */
#define class union
/* This is a public class. */
#define public

#include
class CIsGarbage {
public int x, y;
};
int main() {
class CIsGarbage my_cisgarbage;
my_cisgarbage.x = 3;
my_cisgarbage.y = 4;
printf("%d\n", my_cisgarbage.x); /* expected output: 3 */
return 0;
}

This is giving me 4.

rust is shit and people who think it's going to replace C++ are a fucking joke

how would you go about programming a game ui like picrelated? I'm considering going with electron javascript html/css

I mean to say that are you creating a method because to initialise it all you would need is
x::y() {

}

x::x() : y(), z() {

}

Specifies a no-argument constructor for x that constructs the members y and z with their no-argument constructors.

By not being as horrible pile of trash CPOOPOO is

do you know what a union is dumbfuck
try struct

Rust has modules

>So you can create a method for a class without prototyping it in the class?
No, excuse me by "declaring" I meant "defining," my bad. The method x::x has to already be declared in class x.

>Also what would
>x::x() : y(), z() {
>}
>be doing?
Same thing, the calls to y and z would each initialize either a member or a base object.

> class union (like namespaces)
Whatever poolang you've been using has given you brain damage.

>incorrect linking
Use

Can you even read comments? #define class union defines a class union. I literally just said that.

Don't you have to send to /wdg/ and Sup Forums?

see:

Cpeepee btfo

the code as written, disregarding the retarded comments, works exactly as you would expect

kill yourself

>the code as written, disregarding the retarded comments, works exactly as you would expect
No it doesn't, C is just garbage. It literally can't even handle a class with two public instance variables.

So what's the difference between

x::x() : y() {

}


and

x::y() {

}

>electron javascript html/css
Use Your kind isn't welcome here.

you're fucking clueless

in any other language that has unions it would work the same

make it a struct instead

D doesn't have this problem
tutorialspoint.com/d_programming/d_programming_classes_objects.htm

but I'm just considering it. I'd like to know if there are better options

Top is a constructor. Part of the construction involves initializing a member named y.
Bottom is a member function of x called y.

>he can't read C
>he doesn't know what a union is
sure is summer

>"code"

D has classes, so you don't have to hack together unions to get them

so you're pretending to be retarded

here is your (You)

Who are you quoting?

unions are completely different to classes, you want a struct

>reddit spacing
fuck of to ribbit

>x::x() : y() {
This is for if y is a member of class x. x::x is then a constructor, so as the constructor, it has to construct not only the instance of x but also anything inside it. Since y is inside it, it has to construct y, so it calls y's constructor. This is just a way of doing it before the body of x's constructor actually starts, because otherwise -- if you did it the more intuitive way, by setting the y variable in the constructor -- you'd be constructing y twice, once with its default constructor and once by copy assignment.

>x::y() {
This, on the other hand, assumes y is a *method* of x rather than an ordinary stateful member of it, and starts a definition for y, which must be declared in x before you can define it. You'd also have to precede this definition with a type, e.g. "int x::y()," because in this case, y isn't a constructor for x, and any method that isn't a constructor must have a return type.

>Top is a constructor. Part of the construction involves initializing a member named y.

and how is this different from just initialising the member?

Are you suggesting I put
#define class struct
Because that's dumb. All that would do is define a preprocessor symbol called class struct, which, unlike class union, doesn't have a standardized meaning.

class union does not have any meaning you dumb shit

lol what is the difference between a method and a member? too lazy to google

They are both pointers to some objects user

Not him but:
>and how is this different from just initialising the member?
See: When you do something like "y =", you're initializing y through copy assignment. This means, before that, y had to be constructed, because in C++, variable assignment is a method, and an object needs to be constructed before it can accept method invocations. Using y() cuts out the middleman and just constructs y the way you want it constructed in the first place.

...

C++ does not have strictly methods, but any function that is a member can be colloquially called a method.
class Foo
{
int bar;
void baz() {};
};

bar is a member variable, baz is a member function

It does though, #define class union defines a class union. What is so difficult to understand about this?

JESUS CHRIST PYTHON SUCKS SO MUCH

I don't care. Ask about those thins on >a90.png

#define macros are simply text substitution.
You're stating that all instances of the string "class" will be substituted with "union" before the file gets compiled.

I love coding memes using object oriented coding concepts with javascript, it's a nice way to relax after a long day of playing video games and working on web development. I'm a great coder my favorite meme is pepe the frog hes so goofy and random! xD!

enjoy paying an exorbitant amount of money for a meme degree that has you using a silly language like python

is this fucking bait? I literally used C for all of a few days and even I understand that #define is a preprocessor method that just replaces text.

it's bait

Welp, you've defeated my capacity for trolling.
I guess I could come up with some convoluted explanation as to why that's horseshit (except it actually isn't) but I'm not really feeling it anymore.

btw i posted that from my windows 10 gaming laptop on internet explorer. I'm posting this from my iphone7

>meme
Use >Welp
>""trolling""
Try and >>Sup Forums

what does game ui have to do with web design?

All right, let's try this again

This initialises a member function called y()
x::y() {

}


What does this do differently? Initialise it in the constructor? Does that mean you can prototype member functions IN a constructor?
x::x() : y() {

}

use something reasonable like qt or whatever fucking turbo faggot

>incorrect linking
Use >game
>web """design"""
Fuck off to and

even hand-rolling it with opengl would have worked if you didn't suck

In the latter case, y can't be a member function, it has to be a member variable. The member variable is then initialized by calling its constructor.

what are some video games that use qt for ui?

is this guy meming?

is wasting so much time doing it from scratch really reasonable?

>meming
Everything in your post reeks of reddit.
Seriously: piss off. Your kind is not welcome here.

>what are some video games that use qt for ui?
wiki.qt.io/Qt_Based_Games

>is wasting so much time doing it from scratch really reasonable?
probably not at your skill level

First defines the implementation for a member function called y.
class x {
void y();
}

...

x::y() {

}

...

x.y();


Second initializes the contents of a member variable.
class Y {
// Definition of class y
};

class x {
Y y;
};

x::x() : y() {

};

x myx; // the object myx contains a Y object named y, which has been initialized to the default value

Second might also be initializing a base object.

>video games
>meming
Use

>In the latter case, y can't be a member function, it has to be a member variable. The member variable is then initialized by calling its constructor.

You've completely lost me now, how the fuck does a member variable have a constructor?

>electron javascript html/css
Not programming related.

what kind am I?

>wiki.qt.io/Qt_Based_Games
but these games are a joke. I'm talking something much more complex ui-wise here

>probably not at your skill level
did you just assume my skill level?

isn't javascript a programming language?

Objects can contain other objects as member variables.

>javascript
Not programming related.

In C++, all types have constructors. Even ints have constructors. Specifically, most types, unless explicitly declared otherwise, have two constructors: a default empty constructor, which allocates the object, and, if it's a compound type, calls the empty constructors of its members; and a default copy constructor, which allocates the object and byte-copies the parameter over it. So for example, int i would call int's default constructor, which just allocates the int, whereas int i(7) would call the copy constructor, which allocates i and copies 7 over it.

Pretty sure it's a meme bot.

>what kind am I?
The retarded redditor kind. Piss off.

>meme
Use

>being this dedicated to shitposting
kys desu senpai youre a cuck

>kys desu senpai youre a cuck
Use

okay, let's say I'm gonna write C++ and compile it with emscripten

reddit is pretty cool

>Second initializes the contents of a member variable.
You mean object right? It's initialising the the y object in the x class, right? So when it's initialising the contents of the y object it's initialising the contents of its constructor

Am I getting this right?