0
0

[–] Datawych 0 points 0 points (+0|-0) ago  (edited ago)

Getter and setter functions are simple as fuck. A getter literally just returns the value of a specific class variable. A setter changes the value of a specific class variable. They're semi-redundant ideas that are mostly there to maintain proper data encapsulation.

String getName(){
   return this.name;
}

null setName(String name){
   this.name = name;
} 

Something like that.

Class diagram

Have you learned about UML?

0
1

[–] Rainy-Day-Dream [S] 0 points 1 points (+1|-0) ago 

I kinda get what they are, same with the constructors and deconstructors and the .h file I just don't get how I'm supposed to use them the project works fine right now without any of that in it so I don't know where to put it and what it should do

0
0

[–] Datawych 0 points 0 points (+0|-0) ago  (edited ago)

That's the annoying thing about getters and setters. You don't actually need them. If you code intelligently, you can just sorta make sure that no parts of the program that shouldn't have access to specific data have access to them. It's a due diligence thing.

The idea is to make sure that you can only access/change the name/id/grade variables when referencing instances of that class.

exampleStudent.ID = 12345;

should only work if it's within the Student class. Otherwise, you should have to use

exampleStudent.setID(12345);

Protect ExampleStudent.ID from being changed except in instances where you actually want it to be.

Likewise,

int tempID = exampleStudent.ID; shouldn't work. int tempID = exampleStudent.getID(); should be required. If you have direct access to class variables when you're outside that class, you done fucked up.

[–] [deleted] 0 points 0 points (+0|-0) ago 

[Deleted]

0
0

[–] Rainy-Day-Dream [S] 0 points 0 points (+0|-0) ago 

if that will get me to three files and the guards; then what I missing still is the constructor and destructor, and getter functions

[–] [deleted] 0 points 0 points (+0|-0) ago  (edited ago)

[Deleted]