Search Result

Collapse
9 results in 0.0040 seconds.
Keywords
Members
Tags
constructor
  •  

  • Problem with my class, "cant find symbol on my constructor"?

    I need help with this error that i keep getting when i run my program.

    the error is the following:


    StockProg.java: 15: cannot find symbol
    symbol : constructor Stock(java.lang .String,java.la ng.String,doubl e,double)
    location: class Stock
    Stock mystock = new Stock("wall", "street", 60.0, 65.0);
    ^
    1 error


    When I press the...
    See more | Go to post

  • KENNY LIU
    started a topic C++ constructor help!!
    in C

    C++ constructor help!!

    class description (MyString):

    class defines a sequence of characters (similar to class string). The implementation must be as an array of characters that are dynamically allocated and resized as necessary. You must use a null character to terminate the string - just like C-strings are null terminated.

    deafult constructor:

    Code:
    /// get_length(char *s) gets length of s before null character. buf is private
    ...
    See more | Go to post

  • Pointer gets lost when calling one construction from another

    A constructor to a class takes some arguments including a pointer which is assigned to a class variable. The constructor then calls a default constructor, but inside the default constructor the pointer is no longer valid.

    some code should illustrate.

    Code:
    Feature::Feature(){
        cout<<"at b "<<oc<<endl;
        cout<<"b is "<<oc->geoSphere->getNumVs()<<endl;
    ...
    See more | Go to post

  • mysticwater
    started a topic How does new know how much memory to allocate??
    in C

    How does new know how much memory to allocate??

    Hi,
    I was just wondering how the new operator (in C++) knows how much memory to allocate when creating an object of a class such as shown below:

    i.e

    class Books
    {
    ...
    }

    int main()
    {
    ....
    Books textbook = new Books();
    ....
    }

    I have a stronger C background and I know that in C we have to specify the memory size for...
    See more | Go to post

  • does adding a dummy parameter to constructors of a class to solve calling ambiguity,

    take following class and two object definitions:

    Code:
    class Rect{
     public:
      enum centimeter;
      enum meter;
      Rect(double len,double wid,enum centimeter){
       length=(len/100);
       width=(wid/100);
      }
      Rect(int len,int wid,enum meter){
       length=len;
       width=wid;
      }
      //rest of implementation
     private:
      double length;//in meters
    ...
    See more | Go to post

  • which kinds of constructors may be applied during compile time as optimization.

    take two following classes and their constructors as samples:

    Code:
    class One{
     public:
      One(int a,int b):adad1(a),adad2(b){}
     private:
      int adad1;
      int adad2;
    };
    class Two{
     public:
      Two(int input[]){
       for (int i=0;i<10;i++)
        araye[i]=input[i];
      }
     private:
      int araye[10];
    };
    considering objects with static...
    See more | Go to post

  • Will this initialization syntax be valid in upcoming c++0x standard ?

    Suppose we have following two classes:
    Code:
    class Temp{
     public:
      char a;
      char b;
    };
    class Final{
     private:
      int a;
      char b;
      char c;
     public:
      Final(Temp in):b(in.a),c(in.b){}
      //rest of implementation
    };
    can we initialize an object of the Final class with following syntax in upcoming c++0x standard:
    Final obj(Temp{'a','b '}...
    See more | Go to post

  • Rational Class help. Reduction funtion doesnt work. Linker error in Dev cpp.

    I created a rational class, created member functions to add, subtract, multiply and divide. The reduction function however doesn't work. And the Dev cpp compiler gives a linker error. I have attached the header, implementation and the driver file in rational.zip
    Could you help me fix this code?
    What am I doing wrong?...
    See more | Go to post

  • mrjohn
    started a topic What is "this" in object constructors?

    What is "this" in object constructors?

    Hullo, I've been learning C# and I had a question. I'm creating a class, and I was writing the constructor. When I was assigning values to it's variables, I found that the compiler seems to take it both with and without the "this" keyword. Does it make a difference whether I use it or not?

    [CODE=C#]public class Car
    {
    private float weight, gasTank;
    public Car(float myWeight, float myGasTank)...
    See more | Go to post
Working...