Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › C++/C Programming › Differenct Between (Class) and (Struct) ???

Differenct Between (Class) and (Struct) ???

Posts 1–12 of 12 · Page 1 of 1
ME
meromarololo2
Differenct Between (Class) and (Struct) ???
Is there any difference between struct and class?
Like :
Code:
#include <iostream>
#include <ctime>
using namespace std;


class box{      
private:
	double height,length,width;
	char label;
public:

	double volume()            
	{
		return height*width*length;
	}
	double SA()                
	{
		return 2*height*width + 2*height*length + 2*length*width;
	}
	void Increment_Height(double x)
	{
		height += x;
	}
	double Get_Height()
	{
		return height;        
	}
	
};                              
int main()
{
	srand(time(NULL));
	box me;                     
   system("pause");
   return 0;

}
if i change class by strut, no difference occur, so is there any difference i dont know? sorry im still learning, but in the end of c++ .
#1 · 13y ago
'Bruno
'Bruno
People tend to use structs just as a simple data structure without functions, methods, etc.. Even tho you can use it just like a class.

There is a different there and there but nothing really major.

Pretty sure someone will jump in a give you a more detailed example and explanation...
#2 · 13y ago
Void
Void
structs' members are public by default while a class' members are private by default. i bet you didn't think it was that simple.
#3 · 13y ago
CE
Cernunnos
Just what @Void said, probably you'll prefer using structs as they're public by default and you don't have to type it every time (what u probably do)
#4 · 13y ago
DR
dream90
struct and class are equivalent, except for default access (struct - public) (class - private)
#5 · 13y ago
'Bruno
'Bruno
Quote Originally Posted by Cernunnos View Post
Just what @Void said, probably you'll prefer using structs as they're public by default and you don't have to type it every time (what u probably do)
That makes no sense. You should always say if it public or private... always. It is good practice. (This is the reason why I didnt bother posting that difference)
#6 · 13y ago
KE
Kenshin13
In C++ there's no difference really (Except public/private defaults). I heard in C it had memory differences
#7 · 13y ago
'Bruno
'Bruno
Quote Originally Posted by Kenshin13 View Post
In C++ there's no difference really (Except public/private defaults). I heard in C it had memory differences
There is no classes in C. C is not Object oriented
#8 · 13y ago
KE
Kenshin13
Quote Originally Posted by 'Bruno View Post


There is no classes in C. C is not Object oriented
Well shit, I read it wrong. Just realized. Then I meant C++
#9 · 13y ago
CE
Cernunnos
Quote Originally Posted by 'Bruno View Post


That makes no sense. You should always say if it public or private... always. It is good practice. (This is the reason why I didnt bother posting that difference)
What I'm trying to say is :
Code:
 

class MyClass {
public:
MyClass(int a, double b, float c, char *d); 
int a;
double b;
float c;
char* d;
}
So, if isn't supposed to anything be private why use class instead of struct ?
#10 · 13y ago
lol98lol98
lol98lol98
Quote Originally Posted by Cernunnos View Post
What I'm trying to say is :
Code:
 

class MyClass {
public:
MyClass(int a, double b, float c, char *d); 
int a;
double b;
float c;
char* d;
}
So, if isn't supposed to anything be private why use class instead of struct ?
I think classes can hold structures and functions as well. I don't work with classes or structures much myself so I wouldn't know fully.
#11 · 13y ago
ME
meromarololo
@'Bruno @Void @Cernunnos @dream90 @[MPGH]Kenshin13 @lol98lol98
lolz sorry just after posting this thread i figured out that just like void said, classes are private by default and strukt are public by default..
so i dint open this thread again i even forgot that i posted one
Thx all i apretiate ur help guys
#12 · 13y ago
Posts 1–12 of 12 · Page 1 of 1

Post a Reply

Similar Threads

  • [TUT/Theory] A look at classes! (and structs...ohh and unions too)By schim in C++/C Programming
    14Last post 16y ago
  • whats the diffrence between tapping and the opk hack?By sirh4xalot in Combat Arms Hacks & Cheats
    1Last post 18y ago
  • differen between Europe and USABy 1h1a1i in General
    25Last post 20y ago
  • [Help]Difference between VB6 and VB2005?By MaskedFox in Visual Basic Programming
    1Last post 18y ago
  • Democrats: Too stupid to know the difference between offshore and OCS drilling.By Gigabyt3 in United States of America
    2Last post 18y ago

Tags for this Thread

None