Thread: help in object

  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 int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    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.

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, 11: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, 02:56 PM