fathikhid
asked on
how can i declare Classes in c++
classes in c++ it introduction to "oop"
then i need program using class.
and what mian of consturcter and destructer?
mianing vertiul;
sen a full programme to explian this way.
then i need program using class.
and what mian of consturcter and destructer?
mianing vertiul;
sen a full programme to explian this way.
sorry, we are not allowed to do school project.
you see we don't do homework but i"ll explain a little that you"ll understand the idea
class structure:
class name_of_the_class{
private:
//here goes the private data members
//and the private methods mostlly data
//members
public:
//here goes the public data members
//and the public methods mostlly methods
//and the c'tors and the d'tors
};
now the idea of the c'tor is to updata the class data members with data at the creation of the class like
class myclass{
private:
int x;
public:
myclass(int x1){
x=x1;
}
then in main
myclass class1(1);
//it will create a class named class1 //type of myclass when the x paramter
//will be 1 <x=1>
//the d'tor used to free memory when
//class is distoried it used to free
//dynamic allocated memroy using the
//funcs delete or delete[]
i hope you got the idea now you"ll have to do the rest by yourself
class structure:
class name_of_the_class{
private:
//here goes the private data members
//and the private methods mostlly data
//members
public:
//here goes the public data members
//and the public methods mostlly methods
//and the c'tors and the d'tors
};
now the idea of the c'tor is to updata the class data members with data at the creation of the class like
class myclass{
private:
int x;
public:
myclass(int x1){
x=x1;
}
then in main
myclass class1(1);
//it will create a class named class1 //type of myclass when the x paramter
//will be 1 <x=1>
//the d'tor used to free memory when
//class is distoried it used to free
//dynamic allocated memroy using the
//funcs delete or delete[]
i hope you got the idea now you"ll have to do the rest by yourself
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.