Jump to content

Functions and classes explained


_Seb1

3 posts in this topic

Recommended Posts

So in this information thread I will explain what a Class is and what they are used for. Before I can explain what a Class is I must explain Functions and their usage.

The idea behind Functions that the code should be executed multiple times, so it gets outsorced to a Function. Such Functions can be called randomly in the program and if that happens all the Instructions in the function will be executed. The usage of Functions are not only to prevent code doubles. They can be  appointed very flexibal

- While calling the Function up, your able to send Data into it.

- After the Function has ended you can return Data to its calling place.

as example we will take an easy math function:

f(x) = x²

this function can be called with different Parametres and always computes the square of it. When it gets called up with the parametre 2 it delivers 4 as result.

They are able to work more than a math function though:

- the quantity of the parametres aren‘t limited. You can use many parametres.

- The Datatypes(Int, Float/Double etc other thread) are free choosable so you can use strings or booleans too.

- You can return values to its access point.

How is a Function made?

 

Name

Parametres

Return type

Functionstrunk

Must not be like this, but as C++ is very strict about that, you will need to write all that.

Example for a function:

Return Type Functionname(List_of_Parametres)

{(start of the functionstrunk aka Codeblock)

Instruction1;

Instruction2;

....

}

If a Function should not return Data the special return type void is used.

The list of parametres is a seperated list of Datatype-Name-Pairs.(int alpha, string beta)

The return instrction

The return instruction ends the function and gives the data back to its calling place. example the function f(x) = x²:

int f(int x)

{

  int y;

  y = x * x;

  return y;

}

That above is Pseudocode, you can realize it like that but there are parts missing(like defining x).

It is possible to use more than one return instruction. So as example:

int max(int x, int y)

{

 if (x > y)

    return x;

  return y;

}

It checks if x is bigger than y if thats true it gives back the data to its calling place and ends the function. If it is not true it returns y to the calling place and the function ends here.

Failures in the Function code

int max_failmao(int x, int y)

{

 if (x > y)

  return y;

}

👆wrong because there isnt a return instruction defined for x.

void failures

Void return type: Doesnt return values.

So

void Joka( )

{

 return 5;

}

👆failure

You can still use a return instruction in a void function to end it prematurely.

void WithJoka(int x)

{

if (x > 5)

 return;

}

 

Recursions.

Now because this is not used very often due to its high amount of storage eat, you won‘t face it very often.

int Recursionexample()

{

 return( ) + 1

would always call itself up again and add 1 to its parametres. This endlessrecursion would cause a crash of the program. Recursions are a very elegant way to solve problems but it takes muh storage due to its recalls.

 

Classes

What is a „Class“?

A class is an own datatype you can manage after your favor. In those classes objects(so called instances) are saved. So for the class „Human“ Seb, Tronald Dump etc. can be chosen as instances. Characteristic for classes is that all instances have the same skills(So called attributes: howtall; weight).  Every Instance in a class can perform actions: Like baking a cake(humans).

the skills of each instance can vary(not always the same weight).

You can simulate an own similar world with those classes.

How do you realize it in code?

3 parts:

The name

The skills

The actions

So in C++ a class is made like this:

(easy class)

class ClassnameJokaGay

{

..... Skills and actions .....

}

Actions are realized by functions in this actions are called methods of a class if you made it with functions. In the class you can access the skills(attributes)

Classes always have constructures, those methods are used to make new classinstances. Well now we know how to build a class, but what about a Constructor?

A Constructor is made like a function, having the same name like the class and without giving the return type.

ex.:

class score

{

....

   score( )

   {

     quantitygoalsteam1 = 0;

     quantitygoalsteam2 = 0;

   }

}

So because they are playing and they could shoot some goals we need methods to realize that class.

so ex.:

class score

{

 ....

 void goalsteam1( )

{

 quantitygoalsteam1 = quantitygoalsteam1 + 1;

}

Adds a goal to the team

void goalsteam2( )

 {

  quantityofgoalsteam2 =     quantityofgoalsteam2 + 1;

 }

}

So this was now long enough. If I have time I will create one about how to create instances and use them.

 

 

 

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below. For more information, please read our Posting Guidelines.
Reply to this topic... Posting Guidelines

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Our picks

    • SLIME - ISEKAI Memories v2.0.20 +5 Cheats
      Modded/Hacked App: SLIME - ISEKAI Memories By BANDAI NAMCO Entertainment Inc.
      Bundle ID: jp.co.bandainamcoent.BNEI0402
      iTunes Store Link: https://apps.apple.com/us/app/slime-isekai-memories/id1577316192?uo=4


      Mod Requirements:
      - Jailbroken iPhone/iPad/iPod Touch.
      - Filza / iMazing or any other file managers for iOS.
      - Cydia Substrate, Substitute or libhooker depending on your jailbreak.
      - PreferenceLoader (from Cydia or Sileo).


      Hack Features:
      - 1 Hit Kill
      - Never Die 


      Non-Jailbroken & No Jailbreak required hack(s): https://iosgods.com/forum/79-no-jailbreak-section/
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/


      iOS Hack Download Link:

      Hidden Content
      Download Hack







      Installation Instructions:
      STEP 1: Download the .deb Cydia hack file from the link above.
      STEP 2: Copy the file over to your iDevice using any of the file managers mentioned above or skip this step if you're downloading from your iDevice.
      STEP 3: Using Filza or iFile, browse to where you saved the downloaded .deb file and tap on it.
      STEP 4: Once you tap on the file, you will need to press on 'Install' or 'Installer' from the options on your screen.
      STEP 5: Let Filza / iFile finish the cheat installation. Make sure it successfully installs, otherwise see the note below.
      STEP 6: If the hack is a Mod Menu, which is usually the case nowadays, the cheat features can be toggled in-game. Some cheats have options that can be enabled from your iDevice settings.
      STEP 7: Turn on the features you want and play the game. You may need to follow further instructions inside the hack's popup in-game.

       

      NOTE: If you have any questions or problems, read our Troubleshooting topic & Frequently Asked Questions & Answers topic. If you still haven't found a solution, post your issue down below and we'll do our best to help! If the hack does work for you, post your feedback below and help out other fellow members that are encountering issues.


      Credits:
      - Zahir


      Cheat Video/Screenshots:

      N/A
      • 763 replies
    • Home Defender - Wang's Story v1.1.1 Cheats +3
      Modded/Hacked App: 屋屋保衛戰 By Chengdu Warrior Tech Limited
      Bundle ID: com.warrior.wxw.ioshw
      iTunes Store Link: https://apps.apple.com/us/app/%E5%B1%8B%E5%B1%8B%E4%BF%9D%E8%A1%9B%E6%88%B0/id6476387304?uo=4

       

      Mod Requirements:
      - Non-Jailbroken/Jailed or Jailbroken iPhone/iPad/iPod Touch.
      - Sideloadly / Cydia Impactor or alternatives.
      - A Computer Running Windows/macOS/Linux with iTunes installed.


      Hack Features:
      - Unlimited currency
      - No cd skill
      - Kill all enemies
      • 16 replies
    • Home Defender - Wang's Story v1.1.1 Cheats +3
      Modded/Hacked App: 屋屋保衛戰 By Chengdu Warrior Tech Limited
      Bundle ID: com.warrior.wxw.ioshw
      iTunes Store Link: https://apps.apple.com/us/app/%E5%B1%8B%E5%B1%8B%E4%BF%9D%E8%A1%9B%E6%88%B0/id6476387304?uo=4


      Mod Requirements:
      - Jailbroken iPhone/iPad/iPod Touch.
      - iGameGod / Filza / iMazing or any other file managers for iOS.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak.
      - PreferenceLoader (from Cydia, Sileo or Zebra).


      Hack Features:
      - Unlimited currency
      - No cd skill
      - Kill all enemies
      • 26 replies
    • Idle Lumbercat - Wood Games v1.0.22 Cheats +1
      Modded/Hacked App: Idle Lumbercat - Wood Games By treeplla Inc.
      Bundle ID: com.tree.idle.cat.wood
      iTunes Store Link: https://apps.apple.com/us/app/idle-lumbercat-wood-games/id6470434167?uo=4


      Mod Requirements:
      - Non-Jailbroken/Jailed or Jailbroken iPhone/iPad/iPod Touch.
      - Sideloadly / Cydia Impactor or alternatives.
      - A Computer Running Windows/macOS/Linux with iTunes installed.


      Hack Features:
      - Unlimited currencies
      • 13 replies
    • Idle Lumbercat - Wood Games v1.0.22 Cheats +1
      Modded/Hacked App: Idle Lumbercat - Wood Games By treeplla Inc.
      Bundle ID: com.tree.idle.cat.wood
      iTunes Store Link: https://apps.apple.com/us/app/idle-lumbercat-wood-games/id6470434167?uo=4


      Mod Requirements:
      - Jailbroken iPhone/iPad/iPod Touch.
      - iGameGod / Filza / iMazing or any other file managers for iOS.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak.
      - PreferenceLoader (from Cydia, Sileo or Zebra).


      Hack Features:
      - Unlimited currencies
      • 8 replies
    • We Are Warriors! v1.27.3 Cheats +3
      Modded/Hacked App: We Are Warriors! By Lessmore UG haftungsbeschraenkt
      Bundle ID: com.vjsjlqvlmp.wearewarriors
      iTunes Store Link: https://apps.apple.com/us/app/we-are-warriors/id6466648550?uo=4

       

      Mod Requirements:
      - Non-Jailbroken/Jailed or Jailbroken iPhone/iPad/iPod Touch.
      - Sideloadly / Cydia Impactor or alternatives.
      - A Computer Running Windows/macOS/Linux with iTunes installed.


      Hack Features:
      - Unlimited everything
      - Auto complete task
      • 24 replies
    • We Are Warriors! v1.27.3 Cheats +3
      Modded/Hacked App: We Are Warriors! By Lessmore UG haftungsbeschraenkt
      Bundle ID: com.vjsjlqvlmp.wearewarriors
      iTunes Store Link: https://apps.apple.com/us/app/we-are-warriors/id6466648550?uo=4


      Mod Requirements:
      - Jailbroken iPhone/iPad/iPod Touch.
      - iGameGod / Filza / iMazing or any other file managers for iOS.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak.
      - PreferenceLoader (from Cydia, Sileo or Zebra).


      Hack Features:
      - Unlimited everything
      - Auto complete task
      • 28 replies
    • Boomerang RPG v1.0.46 Cheats +3
      Modded/Hacked App: Boomerang RPG By SuperPlanet corp.
      Bundle ID: com.superplanet.boomerang
      iTunes Store Link: https://apps.apple.com/us/app/boomerang-rpg/id6472151756?uo=4


      Mod Requirements:
      - Non-Jailbroken/Jailed or Jailbroken iPhone/iPad/iPod Touch.
      - Sideloadly / Cydia Impactor or alternatives.
      - A Computer Running Windows/macOS/Linux with iTunes installed.


      Hack Features:
      - God mode
      - High damage
      - Fast attack
      • 43 replies
    • Idle RPG Rosaria Dungeon v1.0.3 +2 Cheats
      Modded/Hacked App: Idle RPG Rosaria Dungeon By Ryoma Shinzato
      Bundle ID: jp.co.justIdea.rosalia.dungeon.prod
      iTunes Store Link: https://apps.apple.com/us/app/idle-rpg-rosaria-dungeon/id6470384597?uo=4


      Mod Requirements:
      - Jailbroken iPhone/iPad/iPod Touch.
      - iGameGod / Filza / iMazing or any other file managers for iOS.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak.
      - PreferenceLoader (from Cydia, Sileo or Zebra).


      Hack Features:
      - Free iAP
      - Unlimited Currencies -> Increase When Use


      Non-Jailbroken & No Jailbreak required hack(s): https://iosgods.com/forum/79-no-jailbreak-section/
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/


      iOS Hack Download Link:

      Hidden Content
      Download Hack







      Installation Instructions:
      STEP 1: Download the .deb Cydia hack file from the link above. Use Safari/Google Chrome or other iOS browsers to download.
      STEP 2: Once the file has downloaded, tap on it and then you will be prompted on whether you want to open the deb with iGameGod or copy it to Filza.
      STEP 3: If necessary, tap on the downloaded file, and then, you will need to press 'Install' from the options on your screen.
      STEP 4: Let iGameGod/Filza finish the cheat installation. Make sure it successfully installs, otherwise see the note below.
      STEP 5: If the hack is a Mod Menu — which is usually the case nowadays — the cheat features can be toggled in-game. Some cheats have options that can be enabled from your iDevice settings.
      STEP 6: Turn on the features you want and play the game. You may need to follow further instructions inside the hack's popup in-game.

       

      NOTE: If you have any questions or problems, read our Troubleshooting topic & Frequently Asked Questions & Answers topic. If you still haven't found a solution, post your issue down below and we'll do our best to help! If the hack does work for you, please post your feedback below and help out other fellow members that are encountering issues.


      Credits:
      - AlyssaX64


      Cheat Video/Screenshots:

      N/A
      • 2 replies
    • OUTERPLANE - Strategy Anime v1.2.11 Cheats +4
      Modded/Hacked App: OUTERPLANE - Strategy Anime By Smilegate Holdings, Inc.
      Bundle ID: com.smilegate.outerplane.stove.ios
      iTunes Store Link: https://apps.apple.com/us/app/outerplane-strategy-anime/id1630880836?uo=4

       

      Mod Requirements:
      - Jailbroken iPhone/iPad/iPod Touch.
      - iGameGod / Filza / iMazing or any other file managers for iOS.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak.
      - PreferenceLoader (from Cydia, Sileo or Zebra).


      Hack Features:
      - God mode
      - OHK
      - Unlimited AP
      - No CD skill
      • 97 replies
    • Idle RPG Night Raid Dungeon v1.0.6 +2 Cheats
      Modded/Hacked App: Idle RPG Night Raid Dungeon By Ryoma Shinzato
      Bundle ID: jp.co.justidea.night.dungeon.prod
      iTunes Store Link: https://apps.apple.com/us/app/idle-rpg-night-raid-dungeon/id6482993960?uo=4


      Mod Requirements:
      - Jailbroken iPhone/iPad/iPod Touch.
      - iGameGod / Filza / iMazing or any other file managers for iOS.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak.
      - PreferenceLoader (from Cydia, Sileo or Zebra).


      Hack Features:
      - Free iAP
      - Unlimited Currencies -> Increase When Use


      Non-Jailbroken & No Jailbreak required hack(s): https://iosgods.com/forum/79-no-jailbreak-section/
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/


      iOS Hack Download Link:

      Hidden Content
      Download Hack







      Installation Instructions:
      STEP 1: Download the .deb Cydia hack file from the link above. Use Safari/Google Chrome or other iOS browsers to download.
      STEP 2: Once the file has downloaded, tap on it and then you will be prompted on whether you want to open the deb with iGameGod or copy it to Filza.
      STEP 3: If necessary, tap on the downloaded file, and then, you will need to press 'Install' from the options on your screen.
      STEP 4: Let iGameGod/Filza finish the cheat installation. Make sure it successfully installs, otherwise see the note below.
      STEP 5: If the hack is a Mod Menu — which is usually the case nowadays — the cheat features can be toggled in-game. Some cheats have options that can be enabled from your iDevice settings.
      STEP 6: Turn on the features you want and play the game. You may need to follow further instructions inside the hack's popup in-game.

       

      NOTE: If you have any questions or problems, read our Troubleshooting topic & Frequently Asked Questions & Answers topic. If you still haven't found a solution, post your issue down below and we'll do our best to help! If the hack does work for you, please post your feedback below and help out other fellow members that are encountering issues.


      Credits:
      - AlyssaX64


      Cheat Video/Screenshots:

      N/A
      • 2 replies
    • Queen's Knights - Slash IDLE v1.0.61 Cheats +2
      Modded/Hacked App: Queen's Knights - Slash IDLE By MGAME Corp
      Bundle ID: com.mgame.queensknights
      iTunes Store Link: https://apps.apple.com/us/app/queens-knights-slash-idle/id6447857625?uo=4

       

      Mod Requirements:
      - Non-Jailbroken/Jailed or Jailbroken iPhone/iPad/iPod Touch.
      - Sideloadly / Cydia Impactor or alternatives.
      - A Computer Running Windows/macOS/Linux with iTunes installed.


      Hack Features:
      - OHK
      - God mode
      • 69 replies
×
  • Create New...

Important Information

We would like to place cookies on your device to help make this website better. The website cannot give you the best user experience without cookies. You can accept or decline our cookies. You may also adjust your cookie settings. Privacy Policy - Guidelines