Skip to main content

Posts

Showing posts from November, 2018

using Object.assign() copy values from one object to another

more details=> https://developer.mozilla.org/en-US/docs/Web/JavaScript /Reference/Global_Objects/Object/assign link is here:- https://stackblitz.com/edit/js-m4m1jh //using Object.assign() we can copy values from one object to aonther object form source to target object and target object return var objectA ={    "name" : "ObjectA" ,     "data" :     {        "x" : 200 ,        "y" : 300     } } var objectB ={    "name" : "ObjectB" ,     "data" :     {        "x" : 1200 ,        "y" : 1300     } } //objectB is source object //objectA is target object Object . assign ( objectA , objectB ); //other example data added from seond object source object to the target object and because the property name is dif...

How can I become a good coder when i am using c++ or swift for my gaming or interactive projects

i will talk about coding standard which i follows in c++ or swift (ios) for c++ define a class name like thats - public myGame extends baseClass checkout class name in camel case use abstract classes whenever you go for inheritance that would help you and other coders that there are some method already declare in base class and he don’t need to be redeclared it and also your base class can access child class method through pointer . overriding in bad habit when its comes to deal with a big project instead of overriding create method with optional parameter which would help you to reduce code in your project. generic templates are best way to deal with common things like defining a template which combine string as well as float and int based on parameter type. including header file in .cpp is bad habbit try to include all header file in .hpp resuse classes are good but too much reusability is another bad habbit for example button->mybutton->mymybutton->anotherbutton ...

classes in typescript

classes and object is more of the most imported part of any object oriented programming language so how to use classes in typescript i am trying to figure it out. as we know classes are blueprints which holds all properties and methods and using instance we can access those properties and methods. so lets try to create a class in typescript working link-> https://stackblitz.com/edit/typescript-yh1fpu //create a class with keyword class following class name class species { // public orign : string ; //declare a class property private specType : string ; //define constructor for your class if you don't define it typescript automatically create it for you constructor () { } //this is how you can define a function in typescipt getSpecType (): string { return this . specType ; } //this is how you can define a function in typescipt setSpecType ( type : string ) { this . specType = type ; }     } //now le...