The Official Programming Thread

puppet

Well-known member
Sep 30, 2013
2,169
0
42
consider one easy book to understand c++
object oriented programming ne buhat buri ki ha
1st semester mei C pari ha isliye idea ha
2nd semester mei ab OOP ha us ki bilkul nai samaj arahi
what is the thing you cant understand in OOP?

classes ?, constructors? inheritance? or what?
 

MegamanEXE

Well-known member
Dec 7, 2007
1,958
1
43
28
Islamabad
shallow copy deep copy
move constructor
operator overloading

teacher ajeeb tareeke se parha raha ha kuch samaj nai aati
Who's teaching you? :p

Basically, this is all low-level power of C++. Pointers and stuff. Other languages won't have that. If you have objects that have pointers as its member variables e.g.

class someObject { int* aPointer; }

someObject A, B;
A = B;

By default, C++ simply equals them both, so it'd be int* = int*

Now, int* is different from int. int is a number, int* is an address. So if the B.aPointer was say 0xPOTATO, it will just assign 0xPOTATO to A.aPointer. It doesn't really care what the type was. It will just straight on assign whatever it has. 0xPOTATO maybe 1,2,3,4,.. etc but it doesn't really care. All that matters is that you change the pointer to point to 0xPOTATO.

This is called shallow copy.

If you were to write your own constructor, which would go 0xPOTATO and take the value inside and THEN assign it to A.aPointer. This is deep copy. You're dealing with numbers here, not addresses.
 
Last edited:

puppet

Well-known member
Sep 30, 2013
2,169
0
42
shallow copy deep copy
move constructor
operator overloading

teacher ajeeb tareeke se parha raha ha kuch samaj nai aati
well operator overloading asan he its just a set that you have to write instructions in it and when you call that operator , the instructions will be processed ,

like function ko name se call karo and operator ko sign se

but about constructors you have to read and understand everything about it , get any OOP book ,you got the default copy constructor completely ? but you need someone near you to teach you while being relaxed, you may ask from any of your classfellows if they can help you , or you can meet your teacher in free time , :)


and arent you able to ask questions from the teacher?

PS : if the whole class remains silent while the lecture of programming is ka mtlb he kisi ko kuch smjh ni aa rhi :crazy:
 
Last edited:

thugslife

-PG-THuG-
Jan 18, 2012
919
0
21
Karachi
Lmao xD This happens so often :D I usually turn around and watch their faces while my sir teaches :D and they are like .. (wtf)
Our theory teacher is so far good but the lady teacher who is taking over lab sucks a lot "student ask miss why are we adding headers file and what the hack is written between the brackets she just like " bus yeah he hota hae ap yad karlain" koi basic concept nae dia :S
 

puppet

Well-known member
Sep 30, 2013
2,169
0
42
Lmao xD This happens so often :D I usually turn around and watch their faces while my sir teaches :D and they are like .. (wtf)
hahah same here , hamary b yahi hota he and girls tu aisay bethi hoti hien jesay altaf bhai ka telephonic khatab sun rahi hon (lmao)

Our theory teacher is so far good but the lady teacher who is taking over lab sucks a lot "student ask miss why are we adding headers file and what the hack is written between the brackets she just like " bus yeah he hota hae ap yad karlain" koi basic concept nae dia :S

lol what semester you are in? and 2nd what uni you are inr? :lol:
lol i know hamary idhar calculus ki teachers b aisa hi behave karti hien , students say teacher ye kiasy, "bus ye math ka rule he karna he tu karo ni tu fail ho jana" (lmao)

but about header i think you are in first semester so thats why she didnt say anything or may be she is not a good teacher jisko headers ka ni pata , bcz its one of the simplest things of programming lel
 

thugslife

-PG-THuG-
Jan 18, 2012
919
0
21
Karachi
hahah same here , hamary b yahi hota he and girls tu aisay bethi hoti hien jesay altaf bhai ka telephonic khatab sun rahi hon (lmao)





lol what semester you are in? and 2nd what uni you are inr? :lol:
lol i know hamary idhar calculus ki teachers b aisa hi behave karti hien , students say teacher ye kiasy, "bus ye math ka rule he karna he tu karo ni tu fail ho jana" (lmao)

but about header i think you are in first semester so thats why she didnt say anything or may be she is not a good teacher jisko headers ka ni pata , bcz its one of the simplest things of programming lel
Yup first semester but our teacher is retard...............
 

puppet

Well-known member
Sep 30, 2013
2,169
0
42
Yup first semester but our teacher is retard...............
ok just for knowledge maybe you know it already but , headers are the files in which all the instructions are already written by the developers , like c++ me trigonometric functions hien na sin cos tan etc , so when we write sin(x); in code then humien isko process karny k liay math ki header file dalni parti he , other we have to write the complete code of finding the value of sin in the program by ourselves , thats why we use boost n libraries like them often in our coding ,
like creal screen function get character function and many like them , so we just dont have to learn rules , we also learn all the functions of libraries that can help us

but when you will complete your data structrs and algorithms courses you will find out in details why we do this and then you can play with them too ;)
 

StrikerX

Moderator
Moderator
Apr 6, 2009
6,636
52
54
Islamabad
what i have learnt so far is that the Universities does not teach you everything about Programming, you have to learn it at your own...!!
The sooner one learns that the better :crazy: Unis don't go beyond management systems unless your course teacher is really good.
 

MegamanEXE

Well-known member
Dec 7, 2007
1,958
1
43
28
Islamabad
what i have learnt so far is that the Universities does not teach you everything about Programming, you have to learn it at your own...!!
Dat revelation. I self-taught myself programming and I'm surprised at the amount of programming they actually teach. Way less than I expected. There are teachers who actually cover a lot of topics, but I observed how many people had no underlying idea of why this concept is necessary, its constraints, what it needs etc. People would show me their code, and I would point immediately point out a very simple mistake, and they'd go "How on earth was I supposed to know that?"

I've lost this edge though since I haven't taught myself anything new in a while. So if anyone thinks he can learn programming solely from a university, he's going to have a bad time :p

It's pretty hard to force yourself to read a book, but once you do, you'll realize how much control you'll have.
 

puppet

Well-known member
Sep 30, 2013
2,169
0
42
The sooner one learns that the better :crazy: Unis don't go beyond management systems unless your course teacher is really good.
humine pata he k hamary teacher ne wohi karvana he jo stupid contents hien , but we tease our teacher sir ye kia chez he sir ye program me phass giya hon zara help kar dien :crazy: teacher acha ho tu karva deta he khud b na ata ho tu kheta he k ap is level pe ya kam na karo chkara jao ge (lmao)

- - - Updated - - -

Dat revelation. I self-taught myself programming and I'm surprised at the amount of programming they actually teach. Way less than I expected.
exactly , thats why i completed 2 programming courses on coursera and i noticed hell difference of study and after that i trust on these free learning courses , unis are just for degrees
 

StrikerX

Moderator
Moderator
Apr 6, 2009
6,636
52
54
Islamabad
But procrastination is go geewddddd! :crazy: *slaps* must not procrastinate :|

Sent from my Nexus 5 using Tapatalk
 

MegamanEXE

Well-known member
Dec 7, 2007
1,958
1
43
28
Islamabad
Well, code is kinda personal. You can invite a PhD programmer, or even Donald Knuth to find what's wrong with someone's code and it's pretty damn difficult. What makes sense to you, doesn't make sense for others. Sometimes some of my friends would just show me 800 lines of code and simply tell me "Yaar ye code naheen chal raha, theek ker do".

And this is the most annoying thing anyone can say to me programming-wise. They just tell to do their work for them. I can fix syntax errors easily. Beyond that, they still ask me to fix their logic errors. I've now learnt to give them the hand. The point is, you shouldn't directly ask a teacher "Sir, ye naheen chal raha, theek ker dein". If he can't, it doesn't mean he sucks, it's just he can't understand how YOU think.

BTW, you were in NUST, right? Who's teaching you?
 

StrikerX

Moderator
Moderator
Apr 6, 2009
6,636
52
54
Islamabad
Well, code is kinda personal. You can invite a PhD programmer, or even Donald Knuth to find what's wrong with someone's code and it's pretty damn difficult. What makes sense to you, doesn't make sense for others. Sometimes some of my friends would just show me 800 lines of code and simply tell me "Yaar ye code naheen chal raha, theek ker do".

And this is the most annoying thing anyone can say to me programming-wise. They just tell to do their work for them. I can fix syntax errors easily. Beyond that, they still ask me to fix their logic errors. I've now learnt to give them the hand. The point is, you shouldn't directly ask a teacher "Sir, ye naheen chal raha, theek ker dein". If he can't, it doesn't mean he sucks, it's just he can't understand how YOU think.

BTW, you were in NUST, right? Who's teaching you?
Haha I know how annoying that is, I've since somewhat taught them how to use the debugger to fix their mistakes so traffic is low now :crazy:
 

puppet

Well-known member
Sep 30, 2013
2,169
0
42
lol nope not logical error , i was talking about like if you are not able to solve the problem , bcz our previous teacher worked hard to teach the quality coding, thats the thing , bcz in huge codes we have to work in a proper way , bcz most of us( students of our class) do 1 work in more than 1 function that can be done in 1 function , thats why our last teacher said that not to make your code dirty like trash , so we dont ask teachers to remove syntax errors or like that , we ask them to make a solution algo so we could solve one problem easily ,

syntax error walay zamane tu guzar gaiy lel ;p
 

salman09

Proficient
Jul 24, 2010
846
0
21
Lahore
well operator overloading asan he its just a set that you have to write instructions in it and when you call that operator , the instructions will be processed ,

like function ko name se call karo and operator ko sign se

but about constructors you have to read and understand everything about it , get any OOP book ,you got the default copy constructor completely ? but you need someone near you to teach you while being relaxed, you may ask from any of your classfellows if they can help you , or you can meet your teacher in free time , :)


and arent you able to ask questions from the teacher?

PS : if the whole class remains silent while the lecture of programming is ka mtlb he kisi ko kuch smjh ni aa rhi :crazy:

the teacher always says any question and we all are like poochien tu poochien kya kuch bi tu samaj nai araha

- - - Updated - - -

Who's teaching you? :p

Basically, this is all low-level power of C++. Pointers and stuff. Other languages won't have that. If you have objects that have pointers as its member variables e.g.

class someObject { int* aPointer; }

someObject A, B;
A = B;

By default, C++ simply equals them both, so it'd be int* = int*

Now, int* is different from int. int is a number, int* is an address. So if the B.aPointer was say 0xPOTATO, it will just assign 0xPOTATO to A.aPointer. It doesn't really care what the type was. It will just straight on assign whatever it has. 0xPOTATO maybe 1,2,3,4,.. etc but it doesn't really care. All that matters is that you change the pointer to point to 0xPOTATO.

This is called shallow copy.

If you were to write your own constructor, which would go 0xPOTATO and take the value inside and THEN assign it to A.aPointer. This is deep copy. You're dealing with numbers here, not addresses.
AAMIR SHAFI

so here is one question aik dynamic memory allocation hum class mei karte hain us ke andar hum data store karte hain ab us ki hum ne deep copy banani ha ke sari cheezien copy hon
including data woh kaise hoga?

- - - Updated - - -

Who's teaching you? :p

Basically, this is all low-level power of C++. Pointers and stuff. Other languages won't have that. If you have objects that have pointers as its member variables e.g.

class someObject { int* aPointer; }

someObject A, B;
A = B;

By default, C++ simply equals them both, so it'd be int* = int*

Now, int* is different from int. int is a number, int* is an address. So if the B.aPointer was say 0xPOTATO, it will just assign 0xPOTATO to A.aPointer. It doesn't really care what the type was. It will just straight on assign whatever it has. 0xPOTATO maybe 1,2,3,4,.. etc but it doesn't really care. All that matters is that you change the pointer to point to 0xPOTATO.

This is called shallow copy.

If you were to write your own constructor, which would go 0xPOTATO and take the value inside and THEN assign it to A.aPointer. This is deep copy. You're dealing with numbers here, not addresses.
AAMIR SHAFI

so here is one question aik dynamic memory allocation hum class mei karte hain us ke andar hum data store karte hain ab us ki hum ne deep copy banani ha ke sari cheezien copy hon
including data woh kaise hoga?

- - - Updated - - -

Plus any suggestions which onliine free course one can take to increase the programming skills particularly for C++

secondly can i manage extra work on programming by taking these online courses in this tedious semester routine?
 

puppet

Well-known member
Sep 30, 2013
2,169
0
42
Get courses from MIT
the teacher always says any question and we all are like poochien tu poochien kya kuch bi tu samaj nai araha

- - - Updated - - -



AAMIR SHAFI

so here is one question aik dynamic memory allocation hum class mei karte hain us ke andar hum data store karte hain ab us ki hum ne deep copy banani ha ke sari cheezien copy hon
including data woh kaise hoga?

- - - Updated - - -



AAMIR SHAFI

so here is one question aik dynamic memory allocation hum class mei karte hain us ke andar hum data store karte hain ab us ki hum ne deep copy banani ha ke sari cheezien copy hon
including data woh kaise hoga?

- - - Updated - - -

Plus any suggestions which onliine free course one can take to increase the programming skills particularly for C++

secondly can i manage extra work on programming by taking these online courses in this tedious semester routine?
 
General chit-chat
Help Users
We have disabled traderscore and are working on a fix. There was a bug with the plugin | Click for Discord
  • No one is chatting at the moment.
  • Necrokiller Necrokiller:
    Reminds me of the time MS tried to charge PC gamers for online play
    Link
  • Necrokiller Necrokiller:
    When will console companies realize this sh*t doesn't work on PC
    Link
  • SolitarySoldier SolitarySoldier:
    doesn't change the fact that sony is extra chu this gen
    Link
  • Link
  • StrikerX StrikerX:
    Mofos sharpened a spear and shoved it up theirs and Arrowhead's ass
    Link
  • StrikerX StrikerX:
    Sony <3
    Link
  • Necrokiller Necrokiller:
    Jeez, throwing all those sales away for the sake of PsN accounts. What a mess.
    Link
  • Link
  • Chandoo Chandoo:
    faraany3k said:
    I have heard that it is now unplayable in countries which do not support handful of third world countries not recognized by Sony like Pakistan. Steam is a true global platform.Then they cry that console gaming is dying.
    170 + countries where Steam sells but PSN doesn't will lose access unless they use VPN
    Link
  • Chandoo Chandoo:
    It has a worst rating on Steam than last years MW3 now. Jeese Sony, how can you fuck it up THIS BAD
    Link
  • faraany3k faraany3k:
    I have heard that it is now unplayable in countries which do not support handful of third world countries not recognized by Sony like Pakistan. Steam is a true global platform.Then they cry that console gaming is dying.
    Link
  • Chandoo Chandoo:
    How to ruin a perfectly good thing for dummies - by Sony
    Link
  • Link
  • Chandoo Chandoo:
    Helldivers 2 is now trending worse stream user reviews than SUICIDE SQUAD
    Link
  • Necrokiller Necrokiller:
    Good guy Gaben refunding the game way past what the policy allows 👍
    Link
  • Necrokiller Necrokiller:
    Poor Arrowhead getting screwed by Sony 😞
    Link
  • Necrokiller Necrokiller:
    Gaben ki reach hai, PSN ki nahi hai. Gaben ain't stressing over publishers who rush to his store in the first place 😂
    Link
  • Chandoo Chandoo:
    Gaben ki reach nah hai :(
    Link
  • Chandoo Chandoo:
    saeen I don't think the PSN teams are stressing over needing to offer hundreds of thousands of refunds lol
    Link
  • Necrokiller Necrokiller:
    fuckin' lol
    Link
  • Necrokiller Necrokiller:
    Saeen literally glossed over the fact that PSN isn't available in those 177 countries
    Link
  • Chandoo Chandoo:
    fuckin' lol
    Link
  • Chandoo Chandoo:
    Helldivers 2 delisted on Steam from 177 countries
    Link
  • Necrokiller Necrokiller:
    iampasha said:
    Alan wake 2 is yet to recover it's development costs. Due to no physical release and no steam launch.
    You reap what you sow. This is what happens when you take away choice from consumers. Even with 88% split going to developers, they can't recoup costs. Meanwhile, Helldivers 2 is a massive hit for Sony thanks in big part to Steam.
    Link
  • iampasha iampasha:
    Alan wake 2 is yet to recover it's development costs. Due to no physical release and no steam launch.
    • Haha
    Reactions: Necrokiller
    Link
    Necrokiller Necrokiller: Reminds me of the time MS tried to charge PC gamers for online play