oop forgetfulness

+1 vote
asked Sep 5, 2018 by Leroy (390 points)
edited Sep 5, 2018 by Leroy
Hi, i was just writing some code unrelated to the factory diagram(maybe i should apply it) but any-hows i was just building a car factory, the concept could in theory be applied to a socket, or so but the codes simple.

I understand the concepts of oop but i forget when i apply it to c#, where the main is important, but when i come back to c++ o forget the relationship when passing in references, and initializing them, and then declaring them either with a constructor, inside its property.

But when ever i get to the main i always forget that: "just because you initialized code doesn't necessarily mean it needs to be the same, only the address its pointing to must be the same.

Where oop in c# is strict, c++ isn't yet i try to find balance in either, but one is pure system design and object designed from the floor the the ceiling and the other is object designed and optionally system designed if needed.

I have a serious problem being stuck inside procedural code, rather oop, and when i implement my, reference, or struct or class in the main i forget to pass in the logic and conditions, and values because i am trying to find that relationship again in the main.

Just because a factory is declared as a class, doesn't mean the values need to be the same in the main, and its that translation from c# where static and const declaration is important as its type sensitive.

But i lose that in c++ when i try to build it from the main when i forget to pass the references in when those references can be anything just as it is in memory.

So my question is: is there any good practice to follow when building code from the class, towards building it in main.cpp.


Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.