help in object

This is a discussion on help in object within the C++ Programming forums, part of the General Programming Boards category; i have this program and i cant compile it Code: #include<stdio.h> #include<iostream> #include<conio.h> class dog { int age, weight; char ...

  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    96

    help in object

    i have this program and i cant compile it

    Code:
    #include<stdio.h>
    #include<iostream>
    #include<conio.h>
    
    class dog
    {
          int age, weight;
          char color;
         
          public:
                void setvalues(int, int, char);
    };
    
    void dog::setvalues(int age, int weight, char color)
    {
         this -> age = age; // using this-> will explicily refer to the class memnert
          weight -> = weight;
          color -> = color;
    
    };
    main()
    {
          dog fido; 
          fido.setvalues(12,55,"gray");
          
          getch();
    
    }

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,506
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Some Interview questions, please help
    By higaea in forum C++ Programming
    Replies: 5
    Last Post: 03-29-2010, 06:35 AM
  2. Inheriting Linked List
    By robolee in forum C++ Programming
    Replies: 20
    Last Post: 10-17-2009, 07:50 PM
  3. Replies: 4
    Last Post: 11-14-2006, 10:52 AM
  4. const at the end of a sub routine?
    By Kleid-0 in forum C++ Programming
    Replies: 14
    Last Post: 10-23-2005, 06:44 PM
  5. Set Classes
    By Nicknameguy in forum C++ Programming
    Replies: 13
    Last Post: 10-31-2002, 01:56 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21