Some examples of programs with use of class

Can someone help me to learn class i dont know how to use class in program

can someone please post some programs having class function.
sourceforge.net/p/gucci <-- That's one of the projects that I own, and it uses two classes, one as an actual class, and the other as an abstraction to that class.
Can you post some simple solutions
plz

Sorry i could not understood

U r not understanding my problem

my sir has given me a problem of class and i was absent for some 5 to 6 dayz

sir wants that program tommorow.

sooo!
Last edited on
No.

EDIT:
It occurs to me that it may be taken as slightly rude for me to just outright say 'No' to posting simple solutions.

It's meant to be.

I literally handed you a very thorough example of using classes and class abstraction, along with dynamic memory allocation and file streaming, including virtual functions, func consts, passing arrays by pointer, passing values by const ref, and static methods of classes, plus I included examples of pointer use, vectors, switches, loops, and the concept of separating each individual idea into it's own function.

You came back and told me that that wasn't good enough, you not only want a good example handed to you on a silver platter, but you also want it in exactly the way that you demand. If you don't want to look at my example, then I'm not going to help you further.
Last edited on
So what's your problem?
Do you have some code to show?
Or you just want to know the different between class and instance?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
class TEST{
public: /* public function and variables are accessible outide object */
  TEST();  /* constructor, is called when object is created */
  ~TEST(); /* destructor, is called when object is destroyed */


  void print();

private:  /* private functions and variables are not accessible outside object */
   int a;

};

TEST::TEST()
{
   a =5; //set private variable a
   cout << "constructor" << endl;   
}

TEST::~TEST()
{
   cout << "destructor" << endl;   
}

void TEST::print()
{
   cout << "print function " << a << endl;
}

int mian()
{
   TEST *test;  //creates an empty pointer

  test = new TEST;     //create the object -> prints "constructor"
  test->print();     //prints "print function 5"

  //cout << test->a << endl;   /* This is not allowed because a is private */

  delete test;          //free the memory -> prints "destructor"

  return 0;
}
Thanks it helped me enough
Topic archived. No new replies allowed.